[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/widgets/ -> class-wp-widget-media.php (summary)

Widget API: WP_Media_Widget class

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

Defines 16 functions

  __construct()
  _register_one()
  get_instance_schema()
  is_attachment_with_mime_type()
  sanitize_token_list()
  widget()
  update()
  form()
  display_media_state()
  enqueue_preview_scripts()
  enqueue_admin_scripts()
  render_control_template_scripts()
  reset_default_labels()
  has_content()
  get_default_description()
  get_l10n_defaults()

Functions
Functions that are not part of a class:

__construct( $id_base, $name, $widget_options = array()   X-Ref
Constructor.

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.

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.

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.
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.
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.

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.
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()`.

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
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.


enqueue_admin_scripts()   X-Ref
Loads the required scripts and styles for the widget control.


render_control_template_scripts()   X-Ref
Render form template scripts.


reset_default_labels()   X-Ref
Resets the cache for the default labels.


has_content( $instance )   X-Ref
Whether the widget has content to show.

return: bool Whether widget has content.
param: array $instance Widget instance props.

get_default_description()   X-Ref
Returns the default description of the widget.

return: string

get_l10n_defaults()   X-Ref
Returns the default localized strings used by the widget.

return: (string|array)[]



Generated : Wed Apr 24 08:20:01 2024 Cross-referenced by PHPXref