[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

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

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()
since: 4.8.0

_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
since: 4.8.0

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.

param: int|WP_Post $attachment Attachment post ID or object.
param: string      $mime_type  MIME type.
return: bool Is matching MIME type.
since: 4.8.0

sanitize_token_list( $tokens )   X-Ref
Sanitize a token list string, such as used in HTML rel and class attributes.

param: string|array $tokens List of tokens separated by spaces, or an array of tokens.
return: string Sanitized token string list.
since: 4.8.0

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.
since: 4.8.0

update( $new_instance, $old_instance )   X-Ref
Sanitizes the widget form values as they are saved.

param: array $new_instance Values just sent to be saved.
param: array $old_instance Previously saved values from database.
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

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.
since: 4.8.0

display_media_state( $states, $post = null )   X-Ref
Filters the default media display states for items in the Media list table.

param: array   $states An array of media states.
param: WP_Post $post   The current attachment object.
return: array
since: 4.8.0

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.

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

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: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1