Screens
abstract class Screens
An extension to the Admin Module that manages code related to particular admin screens, and what code should be run in global or local context.
Properties
| static protected int | $screen_hook_priority |
Methods
The primary entry function for running code globally in the admin area. This code will run with regular Module constructions.
The primary entry function for running code locally in the screen. This code will run in the 'current_screen' WordPress hook.
Return a set of nested associative arrays which define the screens for which code should run.
Iterates through the current screen 'base', 'id', and 'action' sequentially through the valid screens of this class and returns TRUE if they match, otherwise FALSE.
Returns the callback function associated with the current screen in this class. Otherwise, if not on a valid screen, returns FALSE.
The primary entry point for the Admin Module to call when registering this Screen.
The WordPress hook 'current_screen' which should be used to construct the screen module since that is when the data is available.
Details
at line 31
abstract static
construct_screen()
The primary entry function for running code globally in the admin area. This code will run with regular Module constructions.
at line 39
abstract static
current_screen(WP_Screen $current_screen)
The primary entry function for running code locally in the screen. This code will run in the 'current_screen' WordPress hook.
This function will be called when any page from the valid screens is matched.
at line 66
abstract static array[]
get_valid_screens()
Return a set of nested associative arrays which define the screens for which code should run.
The order of nesting should have screen bases, outside screen IDs, outside screen actions, and the actions hold a callable function in the class. An example set of screens for a post type will look like such:
return array(
// The edit.php base pages
'edit' => array(
// The view posts screen action for screen ID 'edit-custom_post_type'.
'edit-custom_post_type' => array(
'' => array( static::class, 'view_posts' ),
),
),
// The post.php base pages
'post' => array(
// The view post (blank) and add new post screen actions for screen ID 'custom_post_type'.
'custom_post_type' => array(
'' => array( static::class, 'view_post' ),
'add' => array( static::class, 'add_post' ),
),
),
);
at line 73
final static bool
is_current_screen()
Iterates through the current screen 'base', 'id', and 'action' sequentially through the valid screens of this class and returns TRUE if they match, otherwise FALSE.
at line 107
final static false|callable
get_current_screen_callback()
Returns the callback function associated with the current screen in this class. Otherwise, if not on a valid screen, returns FALSE.
at line 125
static
construct()
The primary entry point for the Admin Module to call when registering this Screen.
at line 133
final static
_current_screen(WP_Screen $current_screen)
The WordPress hook 'current_screen' which should be used to construct the screen module since that is when the data is available.