[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

WordPress Customize Setting classes

File Size: 1204 lines (38 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 6 files
 wp-includes/customize/class-wp-customize-filter-setting.php
 wp-includes/customize/class-wp-customize-background-image-setting.php
 wp-includes/customize/class-wp-customize-header-image-setting.php
 wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
 wp-includes/customize/class-wp-customize-nav-menu-setting.php
 wp-admin/includes/template.php

Defines 1 class

WP_Customize_Setting:: (31 methods):
  __construct()
  id_data()
  aggregate_multidimensional()
  reset_aggregated_multidimensionals()
  is_current_blog_previewed()
  preview()
  _clear_aggregated_multidimensional_preview_applied_flag()
  suspend_option_preview()
  resume_option_preview()
  is_option_preview_suspended()
  _preview_filter()
  _multidimensional_preview_filter()
  save()
  end_saving()
  post_value()
  sanitize()
  sanitize_option_value()
  validate()
  get_root_value()
  set_root_value()
  update()
  _update_theme_mod()
  _update_option()
  value()
  js_value()
  json()
  check_capabilities()
  multidimensional()
  multidimensional_replace()
  multidimensional_get()
  multidimensional_isset()


Class: WP_Customize_Setting  - X-Ref

Customize Setting class.

Handles saving and sanitizing of settings.

__construct( $manager, $id, $args = array()   X-Ref
Constructor.

Any supplied $args override class property defaults.

param: WP_Customize_Manager $manager Customizer bootstrap instance.
param: string               $id      A specific ID of the setting.
param: array                $args    {

id_data()   X-Ref
Get parsed ID data for multidimensional setting.

return: array {

aggregate_multidimensional()   X-Ref
Set up the setting for aggregated multidimensional values.

When a multidimensional setting gets aggregated, all of its preview and update
calls get combined into one call, greatly improving performance.


reset_aggregated_multidimensionals()   X-Ref
Reset `$aggregated_multidimensionals` static variable.

This is intended only for use by unit tests.


is_current_blog_previewed()   X-Ref
Return true if the current site is not the same as the previewed site.

return: bool If preview() has been called.

preview()   X-Ref
Add filters to supply the setting's value when accessed.

If the setting already has a pre-existing value and there is no incoming
post value for the setting, then this method will short-circuit since
there is no change to preview.

return: bool False when preview short-circuits due no change needing to be previewed.

_clear_aggregated_multidimensional_preview_applied_flag()   X-Ref
Clear out the previewed-applied flag for a multidimensional-aggregated value whenever its post value is updated.

This ensures that the new value will get sanitized and used the next time
that `WP_Customize_Setting::_multidimensional_preview_filter()`
is called for this setting.


suspend_option_preview()   X-Ref
Suspends previewing the setting's option, so that its preview filters pass through the original value.

This is done while the option is being sanitized or saved. Every call must be paired with a call to
{@see WP_Customize_Setting::resume_option_preview()}, including when an exception or error is thrown.


resume_option_preview()   X-Ref
Resumes previewing the setting's option, once each suspension has been resumed.


is_option_preview_suspended()   X-Ref
Determines whether previewing the setting's option is suspended.

return: bool Whether previewing the option is suspended.

_preview_filter( $original )   X-Ref
Callback function to filter non-multidimensional theme mods and options.

If switch_to_blog() was called after the preview() method, and the current
site is now not the same site, then this method does a no-op and returns
the original value.

return: mixed New or old value.
param: mixed $original Old value.

_multidimensional_preview_filter( $original )   X-Ref
Callback function to filter multidimensional theme mods and options.

For all multidimensional settings of a given type, the preview filter for
the first setting previewed will be used to apply the values for the others.

return: mixed New or old value.
param: mixed $original Original root value.

save()   X-Ref
Checks user capabilities and theme supports, and then saves
the value of the setting.

return: void|false Void on success, false if cap check fails

end_saving()   X-Ref
Restores the state changed while saving the setting.


post_value( $default_value = null )   X-Ref
Fetch and sanitize the $_POST value for the setting.

During a save request prior to save, post_value() provides the new value while value() does not.

return: mixed The default value on failure, otherwise the sanitized and validated value.
param: mixed $default_value A default value which is used as a fallback. Default null.

sanitize( $value )   X-Ref
Sanitize an input.

return: string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid.
param: string|array $value The value to sanitize.

sanitize_option_value( $value )   X-Ref
Sanitizes the value of an option setting with `sanitize_option()`.

This applies the sanitization for core options as well as for options sanitized via the
{@see 'sanitize_option_$option'} filter, such as by the `sanitize_callback` passed to
`register_setting()`. The value of a multidimensional setting is sanitized as part of
the root option value.

Any errors added via `add_settings_error()` during sanitization are returned as a `WP_Error`.

return: mixed|WP_Error Sanitized value, or `WP_Error` if invalid.
param: mixed $value Value which has already been sanitized by the setting's sanitize callback.

validate( $value )   X-Ref
Validates an input.

return: true|WP_Error True if the input was validated, otherwise WP_Error.
param: mixed $value Value to validate.

get_root_value( $default_value = null )   X-Ref
Get the root value for a setting, especially for multidimensional ones.

return: mixed
param: mixed $default_value Value to return if root does not exist.

set_root_value( $value )   X-Ref
Set the root value for a setting, especially for multidimensional ones.

return: bool Whether the multidimensional root was updated successfully.
param: mixed $value Value to set as root of multidimensional setting.

update( $value )   X-Ref
Save the value of the setting, using the related API.

return: bool The result of saving the value.
param: mixed $value The value to update.

_update_theme_mod()   X-Ref
Deprecated method.


_update_option()   X-Ref
Deprecated method.


value()   X-Ref
Fetch the value of the setting.

return: mixed The value.

js_value()   X-Ref
Sanitize the setting's value for use in JavaScript.

return: mixed The requested escaped value.

json()   X-Ref
Retrieves the data to export to the client via JSON.

return: array Array of parameters passed to JavaScript.

check_capabilities()   X-Ref
Validate user capabilities whether the theme supports the setting.

return: bool False if theme doesn't support the setting or user can't change setting, otherwise true.

multidimensional( &$root, $keys, $create = false )   X-Ref
Multidimensional helper function.

return: array|null Keys are 'root', 'node', and 'key'.
param: array $root
param: array $keys
param: bool  $create Default false.

multidimensional_replace( $root, $keys, $value )   X-Ref
Will attempt to replace a specific value in a multidimensional array.

return: mixed
param: array $root
param: array $keys
param: mixed $value The value to update.

multidimensional_get( $root, $keys, $default_value = null )   X-Ref
Will attempt to fetch a specific value from a multidimensional array.

return: mixed The requested value or the default value.
param: array $root
param: array $keys
param: mixed $default_value A default value which is used as a fallback. Default null.

multidimensional_isset( $root, $keys )   X-Ref
Will attempt to check if a specific value in a multidimensional array is set.

return: bool True if value is set, false if not.
param: array $root
param: array $keys



Generated : Sat Nov 28 08:20:01 2026 Cross-referenced by PHPXref