[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Customize Widgets classes

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

Defines 67 functions

  __construct()
  get_selective_refreshable_widgets()
  is_widget_selective_refreshable()
  get_setting_type()
  register_settings()
  filter_customize_dynamic_setting_args()
  get_post_value()
  override_sidebars_widgets_for_theme_switch()
  filter_customize_value_old_sidebars_widgets_data()
  filter_option_sidebars_widgets_for_theme_switch()
  customize_controls_init()
  schedule_customize_register()
  customize_register()
  is_panel_active()
  get_setting_id()
  is_wide_widget()
  parse_widget_id()
  parse_widget_setting_id()
  print_styles()
  print_scripts()
  enqueue_scripts()
  output_widget_control_templates()
  print_footer_scripts()
  get_setting_args()
  sanitize_sidebar_widgets()
  get_available_widgets()
  _sort_name_callback()
  get_widget_control()
  get_widget_control_parts()
  customize_preview_init()
  refresh_nonces()
  should_load_block_editor_scripts_and_styles()
  preview_sidebars_widgets()
  customize_preview_enqueue()
  print_preview_css()
  export_preview_data()
  tally_rendered_widgets()
  is_widget_rendered()
  is_sidebar_rendered()
  tally_sidebars_via_is_active_sidebar_calls()
  tally_sidebars_via_dynamic_sidebar_calls()
  get_instance_hash_key()
  sanitize_widget_instance()
  sanitize_widget_js_instance()
  sanitize_sidebar_widgets_js_instance()
  call_widget_update()
  wp_ajax_update_widget()
  customize_dynamic_partial_args()
  selective_refresh_init()
  filter_dynamic_sidebar_params()
  filter_wp_kses_allowed_data_attributes()
  start_dynamic_sidebar()
  end_dynamic_sidebar()
  filter_sidebars_widgets_for_rendering_widget()
  render_widget_partial()
  is_option_capture_ignored()
  get_captured_options()
  get_captured_option()
  count_captured_options()
  start_capturing_option_updates()
  capture_filter_pre_update_option()
  capture_filter_pre_get_option()
  stop_capturing_option_updates()
  setup_widget_addition_previews()
  prepreview_added_sidebars_widgets()
  prepreview_added_widget_instance()
  remove_prepreview_filters()

Functions
Functions that are not part of a class:

__construct( $manager )   X-Ref
Initial loader.

param: WP_Customize_Manager $manager Customizer bootstrap instance.
since: 3.9.0

get_selective_refreshable_widgets()   X-Ref
List whether each registered widget can be use selective refresh.

If the theme does not support the customize-selective-refresh-widgets feature,
then this will always return an empty array.

return: array Mapping of id_base to support. If theme doesn't support
since: 4.5.0

is_widget_selective_refreshable( $id_base )   X-Ref
Determines if a widget supports selective refresh.

return: bool Whether the widget can be selective refreshed.
param: string $id_base Widget ID Base.
since: 4.5.0

get_setting_type( $setting_id )   X-Ref
Retrieves the widget setting type given a setting ID.

return: string|void Setting type.
param: string $setting_id Setting ID.
since: 4.2.0

register_settings()   X-Ref
Inspects the incoming customized data for any widget settings, and dynamically adds
them up-front so widgets will be initialized properly.

since: 4.2.0

filter_customize_dynamic_setting_args( $args, $setting_id )   X-Ref
Determines the arguments for a dynamically-created setting.

return: array|false Setting arguments, false otherwise.
param: false|array $args       The arguments to the WP_Customize_Setting constructor.
param: string      $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`.
since: 4.2.0

get_post_value( $name, $default_value = null )   X-Ref
Retrieves an unslashed post value or return a default.

return: mixed Unslashed post value or default value.
param: string $name          Post value.
param: mixed  $default_value Default post value.
since: 3.9.0

override_sidebars_widgets_for_theme_switch()   X-Ref
Override sidebars_widgets for theme switch.

When switching a theme via the Customizer, supply any previously-configured
sidebars_widgets from the target theme as the initial sidebars_widgets
setting. Also store the old theme's existing settings so that they can
be passed along for storing in the sidebars_widgets theme_mod when the
theme gets switched.

since: 3.9.0

filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets )   X-Ref
Filters old_sidebars_widgets_data Customizer setting.

When switching themes, filter the Customizer setting old_sidebars_widgets_data
to supply initial $sidebars_widgets before they were overridden by retrieve_widgets().
The value for old_sidebars_widgets_data gets set in the old theme's sidebars_widgets
theme_mod.

return: array
param: array $old_sidebars_widgets
since: 3.9.0

filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets )   X-Ref
Filters sidebars_widgets option for theme switch.

When switching themes, the retrieve_widgets() function is run when the Customizer initializes,
and then the new sidebars_widgets here get supplied as the default value for the sidebars_widgets
option.

return: array
param: array $sidebars_widgets
since: 3.9.0

customize_controls_init()   X-Ref
Ensures all widgets get loaded into the Customizer.

Note: these actions are also fired in wp_ajax_update_widget().

since: 3.9.0

schedule_customize_register()   X-Ref
Ensures widgets are available for all types of previews.

When in preview, hook to {@see 'customize_register'} for settings after WordPress is loaded
so that all filters have been initialized (e.g. Widget Visibility).

since: 3.9.0

customize_register()   X-Ref
Registers Customizer settings and controls for all sidebars and widgets.

since: 3.9.0

is_panel_active()   X-Ref
Determines whether the widgets panel is active, based on whether there are sidebars registered.

return: bool Active.
since: 4.4.0

get_setting_id( $widget_id )   X-Ref
Converts a widget_id into its corresponding Customizer setting ID (option name).

return: string Maybe-parsed widget ID.
param: string $widget_id Widget ID.
since: 3.9.0

is_wide_widget( $widget_id )   X-Ref
Determines whether the widget is considered "wide".

Core widgets which may have controls wider than 250, but can still be shown
in the narrow Customizer panel. The RSS and Text widgets in Core, for example,
have widths of 400 and yet they still render fine in the Customizer panel.

This method will return all Core widgets as being not wide, but this can be
overridden with the {@see 'is_wide_widget_in_customizer'} filter.

return: bool Whether or not the widget is a "wide" widget.
param: string $widget_id Widget ID.
since: 3.9.0

parse_widget_id( $widget_id )   X-Ref
Converts a widget ID into its id_base and number components.

return: array Array containing a widget's id_base and number components.
param: string $widget_id Widget ID.
since: 3.9.0

parse_widget_setting_id( $setting_id )   X-Ref
Converts a widget setting ID (option path) to its id_base and number components.

return: array|WP_Error Array containing a widget's id_base and number components,
param: string $setting_id Widget setting ID.
since: 3.9.0

print_styles()   X-Ref
Calls admin_print_styles-widgets.php and admin_print_styles hooks to
allow custom styles from plugins.

since: 3.9.0

print_scripts()   X-Ref
Calls admin_print_scripts-widgets.php and admin_print_scripts hooks to
allow custom scripts from plugins.

since: 3.9.0

enqueue_scripts()   X-Ref
Enqueues scripts and styles for Customizer panel and export data to JavaScript.

since: 3.9.0

output_widget_control_templates()   X-Ref
Renders the widget form control templates into the DOM.

since: 3.9.0

print_footer_scripts()   X-Ref
Calls admin_print_footer_scripts and admin_print_scripts hooks to
allow custom scripts from plugins.

since: 3.9.0

get_setting_args( $id, $overrides = array()   X-Ref
Retrieves common arguments to supply when constructing a Customizer setting.

return: array Possibly modified setting arguments.
param: string $id        Widget setting ID.
param: array  $overrides Array of setting overrides.
since: 3.9.0

sanitize_sidebar_widgets( $widget_ids )   X-Ref
Ensures sidebar widget arrays only ever contain widget IDS.

Used as the 'sanitize_callback' for each $sidebars_widgets setting.

return: string[] Array of sanitized widget IDs.
param: string[] $widget_ids Array of widget IDs.
since: 3.9.0

get_available_widgets()   X-Ref
Builds up an index of all available widgets for use in Backbone models.

return: array List of available widgets.
since: 3.9.0

_sort_name_callback( $widget_a, $widget_b )   X-Ref
Naturally orders available widgets by name.

return: int Reorder position for the current widget comparison.
param: array $widget_a The first widget to compare.
param: array $widget_b The second widget to compare.
since: 3.9.0

get_widget_control( $args )   X-Ref
Retrieves the widget control markup.

return: string Widget control form HTML markup.
param: array $args Widget control arguments.
since: 3.9.0

get_widget_control_parts( $args )   X-Ref
Retrieves the widget control markup parts.

return: array {
param: array $args Widget control arguments.
since: 4.4.0

customize_preview_init()   X-Ref
Adds hooks for the Customizer preview.

since: 3.9.0

refresh_nonces( $nonces )   X-Ref
Refreshes the nonce for widget updates.

return: array Array of nonces.
param: array $nonces Array of nonces.
since: 4.2.0

should_load_block_editor_scripts_and_styles( $is_block_editor_screen )   X-Ref
Tells the script loader to load the scripts and styles of custom blocks
if the widgets block editor is enabled.

return: bool Filtered decision about loading block assets.
param: bool $is_block_editor_screen Current decision about loading block assets.
since: 5.8.0

preview_sidebars_widgets( $sidebars_widgets )   X-Ref
When previewing, ensures the proper previewing widgets are used.

Because wp_get_sidebars_widgets() gets called early at {@see 'init' } (via
wp_convert_widget_settings()) and can set global variable `$_wp_sidebars_widgets`
to the value of `get_option( 'sidebars_widgets' )` before the Customizer preview
filter is added, it has to be reset after the filter has been added.

return: array
param: array $sidebars_widgets List of widgets for the current sidebar.
since: 3.9.0

customize_preview_enqueue()   X-Ref
Enqueues scripts for the Customizer preview.

since: 3.9.0

print_preview_css()   X-Ref
Inserts default style for highlighted widget at early point so theme
stylesheet can override.

since: 3.9.0

export_preview_data()   X-Ref
Communicates the sidebars that appeared on the page at the very end of the page,
and at the very end of the wp_footer,

since: 3.9.0

tally_rendered_widgets( $widget )   X-Ref
Tracks the widgets that were rendered.

param: array $widget Rendered widget to tally.
since: 3.9.0

is_widget_rendered( $widget_id )   X-Ref
Determine if a widget is rendered on the page.

return: bool Whether the widget is rendered.
param: string $widget_id Widget ID to check.
since: 4.0.0

is_sidebar_rendered( $sidebar_id )   X-Ref
Determines if a sidebar is rendered on the page.

return: bool Whether the sidebar is rendered.
param: string $sidebar_id Sidebar ID to check.
since: 4.0.0

tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id )   X-Ref
Tallies the sidebars rendered via is_active_sidebar().

Keep track of the times that is_active_sidebar() is called in the template,
and assume that this means that the sidebar would be rendered on the template
if there were widgets populating it.

return: bool Whether the sidebar is active.
param: bool   $is_active  Whether the sidebar is active.
param: string $sidebar_id Sidebar ID.
since: 3.9.0

tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id )   X-Ref
Tallies the sidebars rendered via dynamic_sidebar().

Keep track of the times that dynamic_sidebar() is called in the template,
and assume this means the sidebar would be rendered on the template if
there were widgets populating it.

return: bool Whether the current sidebar has widgets.
param: bool   $has_widgets Whether the current sidebar has widgets.
param: string $sidebar_id  Sidebar ID.
since: 3.9.0

get_instance_hash_key( $serialized_instance )   X-Ref
Retrieves MAC for a serialized widget instance string.

Allows values posted back from JS to be rejected if any tampering of the
data has occurred.

return: string MAC for serialized widget instance.
param: string $serialized_instance Widget instance.
since: 3.9.0

sanitize_widget_instance( $value, $id_base = null )   X-Ref
Sanitizes a widget instance.

Unserialize the JS-instance for storing in the options. It's important that this filter
only get applied to an instance *once*.

return: array|void Sanitized widget instance.
param: array  $value   Widget instance to sanitize.
param: string $id_base Optional. Base of the ID of the widget being sanitized. Default null.
since: 3.9.0
since: 5.8.0 Added the `$id_base` parameter.

sanitize_widget_js_instance( $value, $id_base = null )   X-Ref
Converts a widget instance into JSON-representable format.

return: array JSON-converted widget instance.
param: array  $value   Widget instance to convert to JSON.
param: string $id_base Optional. Base of the ID of the widget being sanitized. Default null.
since: 3.9.0
since: 5.8.0 Added the `$id_base` parameter.

sanitize_sidebar_widgets_js_instance( $widget_ids )   X-Ref
Strips out widget IDs for widgets which are no longer registered.

One example where this might happen is when a plugin orphans a widget
in a sidebar upon deactivation.

return: array Parsed list of widget IDs.
param: array $widget_ids List of widget IDs.
since: 3.9.0

call_widget_update( $widget_id )   X-Ref
Finds and invokes the widget update and control callbacks.

Requires that `$_POST` be populated with the instance data.

return: array|WP_Error Array containing the updated widget information.
param: string $widget_id Widget ID.
since: 3.9.0

wp_ajax_update_widget()   X-Ref
Updates widget settings asynchronously.

Allows the Customizer to update a widget using its form, but return the new
instance info via Ajax instead of saving it to the options table.

Most code here copied from wp_ajax_save_widget().

since: 3.9.0

customize_dynamic_partial_args( $partial_args, $partial_id )   X-Ref
Filters arguments for dynamic widget partials.

return: array (Maybe) modified partial arguments.
param: array|false $partial_args Partial arguments.
param: string      $partial_id   Partial ID.
since: 4.5.0

selective_refresh_init()   X-Ref
Adds hooks for selective refresh.

since: 4.5.0

filter_dynamic_sidebar_params( $params )   X-Ref
Inject selective refresh data attributes into widget container elements.

return: array Params.
param: array $params {
since: 4.5.0

filter_wp_kses_allowed_data_attributes( $allowed_html )   X-Ref
Ensures the HTML data-* attributes for selective refresh are allowed by kses.

This is needed in case the `$before_widget` is run through wp_kses() when printed.

return: array (Maybe) modified allowed HTML.
param: array $allowed_html Allowed HTML.
since: 4.5.0

start_dynamic_sidebar( $index )   X-Ref
Begins keeping track of the current sidebar being rendered.

Insert marker before widgets are rendered in a dynamic sidebar.

param: int|string $index Index, name, or ID of the dynamic sidebar.
since: 4.5.0

end_dynamic_sidebar( $index )   X-Ref
Finishes keeping track of the current sidebar being rendered.

Inserts a marker after widgets are rendered in a dynamic sidebar.

param: int|string $index Index, name, or ID of the dynamic sidebar.
since: 4.5.0

filter_sidebars_widgets_for_rendering_widget( $sidebars_widgets )   X-Ref
Filters sidebars_widgets to ensure the currently-rendered widget is the only widget in the current sidebar.

return: array Filtered sidebars widgets.
param: array $sidebars_widgets Sidebars widgets.
since: 4.5.0

render_widget_partial( $partial, $context )   X-Ref
Renders a specific widget using the supplied sidebar arguments.

return: string|false
param: WP_Customize_Partial $partial Partial.
param: array                $context {
since: 4.5.0

is_option_capture_ignored( $option_name )   X-Ref
Determines whether the captured option update should be ignored.

return: bool Whether the option capture is ignored.
param: string $option_name Option name.
since: 3.9.0

get_captured_options()   X-Ref
Retrieves captured widget option updates.

return: array Array of captured options.
since: 3.9.0

get_captured_option( $option_name, $default_value = false )   X-Ref
Retrieves the option that was captured from being saved.

return: mixed Value set for the option.
param: string $option_name   Option name.
param: mixed  $default_value Optional. Default value to return if the option does not exist. Default false.
since: 4.2.0

count_captured_options()   X-Ref
Retrieves the number of captured widget option updates.

return: int Number of updated options.
since: 3.9.0

start_capturing_option_updates()   X-Ref
Begins keeping track of changes to widget options, caching new values.

since: 3.9.0

capture_filter_pre_update_option( $new_value, $option_name, $old_value )   X-Ref
Pre-filters captured option values before updating.

return: mixed Filtered option value.
param: mixed  $new_value   The new option value.
param: string $option_name Name of the option.
param: mixed  $old_value   The old option value.
since: 3.9.0

capture_filter_pre_get_option( $value )   X-Ref
Pre-filters captured option values before retrieving.

return: mixed Filtered option value.
param: mixed $value Value to return instead of the option value.
since: 3.9.0

stop_capturing_option_updates()   X-Ref
Undoes any changes to the options since options capture began.

since: 3.9.0

setup_widget_addition_previews()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

prepreview_added_sidebars_widgets()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

prepreview_added_widget_instance()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

remove_prepreview_filters()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0



Generated: Sat Nov 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1