[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> class-wp-screen.php (summary)

Screen API: WP_Screen class

File Size: 1359 lines (37 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 33 functions

  get()
  set_current_screen()
  __construct()
  in_admin()
  is_block_editor()
  add_old_compat_help()
  set_parentage()
  add_option()
  remove_option()
  remove_options()
  get_options()
  get_option()
  get_help_tabs()
  get_help_tab()
  add_help_tab()
  remove_help_tab()
  remove_help_tabs()
  get_help_sidebar()
  set_help_sidebar()
  get_columns()
  get_screen_reader_content()
  get_screen_reader_text()
  set_screen_reader_content()
  remove_screen_reader_content()
  render_screen_meta()
  show_screen_options()
  render_screen_options()
  render_meta_boxes_preferences()
  render_list_table_columns_preferences()
  render_screen_layout()
  render_per_page_options()
  render_view_mode()
  render_screen_reader_content()

Functions
Functions that are not part of a class:

get( $hook_name = '' )   X-Ref
Fetches a screen object.

return: WP_Screen Screen object.
param: string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.

set_current_screen()   X-Ref
Makes the screen object the current screen.


__construct()   X-Ref
Constructor


in_admin( $admin = null )   X-Ref
Indicates whether the screen is in a particular admin.

return: bool True if the screen is in the indicated admin, false otherwise.
param: string $admin The admin to check against (network | user | site).

is_block_editor( $set = null )   X-Ref
Sets or returns whether the block editor is loading on the current screen.

return: bool True if the block editor is being loaded, false otherwise.
param: bool $set Optional. Sets whether the block editor is loading on the current screen or not.

add_old_compat_help( $screen, $help )   X-Ref
Sets the old string-based contextual help for the screen for backward compatibility.

param: WP_Screen $screen A screen object.
param: string    $help   Help text.

set_parentage( $parent_file )   X-Ref
Sets the parent information for the screen.

This is called in admin-header.php after the menu parent for the screen has been determined.

param: string $parent_file The parent file of the screen. Typically the $parent_file global.

add_option( $option, $args = array()   X-Ref
Adds an option for the screen.

Call this in template files after admin.php is loaded and before admin-header.php is loaded
to add screen options.

param: string $option Option ID.
param: mixed  $args   Option-dependent arguments.

remove_option( $option )   X-Ref
Removes an option from the screen.

param: string $option Option ID.

remove_options()   X-Ref
Removes all options from the screen.


get_options()   X-Ref
Gets the options registered for the screen.

return: array Options with arguments.

get_option( $option, $key = false )   X-Ref
Gets the arguments for an option for the screen.

return: string The option value if set, null otherwise.
param: string       $option Option name.
param: string|false $key    Optional. Specific array key for when the option is an array.

get_help_tabs()   X-Ref
Gets the help tabs registered for the screen.

return: array Help tabs with arguments.

get_help_tab( $id )   X-Ref
Gets the arguments for a help tab.

return: array Help tab arguments.
param: string $id Help Tab ID.

add_help_tab( $args )   X-Ref
Adds a help tab to the contextual help for the screen.

Call this on the `load-$pagenow` hook for the relevant screen,
or fetch the `$current_screen` object, or use get_current_screen()
and then call the method from the object.

You may need to filter `$current_screen` using an if or switch statement
to prevent new help tabs from being added to ALL admin screens.

param: array $args {

remove_help_tab( $id )   X-Ref
Removes a help tab from the contextual help for the screen.

param: string $id The help tab ID.

remove_help_tabs()   X-Ref
Removes all help tabs from the contextual help for the screen.


get_help_sidebar()   X-Ref
Gets the content from a contextual help sidebar.

return: string Contents of the help sidebar.

set_help_sidebar( $content )   X-Ref
Adds a sidebar to the contextual help for the screen.

Call this in template files after admin.php is loaded and before admin-header.php is loaded
to add a sidebar to the contextual help.

param: string $content Sidebar content in plain text or HTML.

get_columns()   X-Ref
Gets the number of layout columns the user has selected.

The layout_columns option controls the max number and default number of
columns. This method returns the number of columns within that range selected
by the user via Screen Options. If no selection has been made, the default
provisioned in layout_columns is returned. If the screen does not support
selecting the number of layout columns, 0 is returned.

return: int Number of columns to display.

get_screen_reader_content()   X-Ref
Gets the accessible hidden headings and text used in the screen.

return: string[] An associative array of screen reader text strings.

get_screen_reader_text( $key )   X-Ref
Gets a screen reader text string.

return: string Screen reader text string.
param: string $key Screen reader text array named key.

set_screen_reader_content( $content = array()   X-Ref
Adds accessible hidden headings and text for the screen.

param: array $content {

remove_screen_reader_content()   X-Ref
Removes all the accessible hidden headings and text for the screen.


render_screen_meta()   X-Ref
Renders the screen's help section.

This will trigger the deprecated filters for backward compatibility.


show_screen_options()   X-Ref

return: bool

render_screen_options( $options = array()   X-Ref
Renders the screen options tab.

param: array $options {

render_meta_boxes_preferences()   X-Ref
Renders the meta boxes preferences.


render_list_table_columns_preferences()   X-Ref
Renders the list table columns preferences.


render_screen_layout()   X-Ref
Renders the option for number of columns on the page.


render_per_page_options()   X-Ref
Renders the items per page option.


render_view_mode()   X-Ref
Renders the list table view mode preferences.


render_screen_reader_content( $key = '', $tag = 'h2' )   X-Ref
Renders screen reader text.

param: string $key The screen reader text array named key.
param: string $tag Optional. The HTML tag to wrap the screen reader text. Default h2.



Generated : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref