[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Widget API: WP_Media_Widget class
File Size: | 512 lines (15 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
__construct( $id_base, $name, $widget_options = array() X-Ref |
Constructor. since: 4.8.0 param: string $id_base Base ID for the widget, lowercase and unique. param: string $name Name for the widget displayed on the configuration page. param: array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for param: array $control_options Optional. Widget control options. See wp_register_widget_control() |
_register_one( $number = -1 ) X-Ref |
Add hooks while registering all widget instances of this widget class. since: 4.8.0 param: int $number Optional. The unique order number of this widget instance |
get_instance_schema() X-Ref |
Get schema for properties of a widget instance (item). return: array Schema for properties. since: 4.8.0 |
is_attachment_with_mime_type( $attachment, $mime_type ) X-Ref |
Determine if the supplied attachment is for a valid attachment post with the specified MIME type. return: bool Is matching MIME type. since: 4.8.0 param: int|WP_Post $attachment Attachment post ID or object. param: string $mime_type MIME type. |
sanitize_token_list( $tokens ) X-Ref |
Sanitize a token list string, such as used in HTML rel and class attributes. return: string Sanitized token string list. since: 4.8.0 param: string|array $tokens List of tokens separated by spaces, or an array of tokens. |
widget( $args, $instance ) X-Ref |
Displays the widget on the front-end. since: 4.8.0 param: array $args Display arguments including before_title, after_title, before_widget, and after_widget. param: array $instance Saved setting from the database. |
update( $new_instance, $old_instance ) X-Ref |
Sanitizes the widget form values as they are saved. return: array Updated safe values to be saved. since: 4.8.0 since: 5.9.0 Renamed `$instance` to `$old_instance` to match parent class param: array $new_instance Values just sent to be saved. param: array $old_instance Previously saved values from database. |
form( $instance ) X-Ref |
Outputs the settings update form. Note that the widget UI itself is rendered with JavaScript via `MediaWidgetControl#render()`. since: 4.8.0 param: array $instance Current settings. |
display_media_state( $states, $post = null ) X-Ref |
Filters the default media display states for items in the Media list table. return: array since: 4.8.0 param: array $states An array of media states. param: WP_Post $post The current attachment object. |
enqueue_preview_scripts() X-Ref |
Enqueue preview scripts. These scripts normally are enqueued just-in-time when a widget is rendered. In the customizer, however, widgets can be dynamically added and rendered via selective refresh, and so it is important to unconditionally enqueue them in case a widget does get added. since: 4.8.0 |
enqueue_admin_scripts() X-Ref |
Loads the required scripts and styles for the widget control. since: 4.8.0 |
render_control_template_scripts() X-Ref |
Render form template scripts. since: 4.8.0 |
reset_default_labels() X-Ref |
Resets the cache for the default labels. since: 6.0.0 |
has_content( $instance ) X-Ref |
Whether the widget has content to show. return: bool Whether widget has content. since: 4.8.0 param: array $instance Widget instance props. |
get_default_description() X-Ref |
Returns the default description of the widget. return: string since: 6.0.0 |
get_l10n_defaults() X-Ref |
Returns the default localized strings used by the widget. return: (string|array)[] since: 6.0.0 |
Generated: Thu Dec 5 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |