Docs: Add a reference to `WP_Customize_Setting::__construct()` for information on accepted arguments in `WP_Customize_Manager::add_setting()`.

Synchronize the documentation between two places, use `WP_Customize_Setting::__construct()` as the canonical source.

Props tmanoilov, marekdedic.
Fixes #48347.
Built from https://develop.svn.wordpress.org/trunk@47384


git-svn-id: http://core.svn.wordpress.org/trunk@47171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-27 20:09:06 +00:00
parent ac9b6fcef8
commit 8c5a8f1811
4 changed files with 28 additions and 26 deletions

View File

@ -174,7 +174,7 @@ class WP_Customize_Control {
* @param WP_Customize_Manager $manager Customizer bootstrap instance. * @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id Control ID. * @param string $id Control ID.
* @param array $args { * @param array $args {
* Optional. Arguments to override class property defaults. * Optional. Array of properties for the new Control object. Default empty array.
* *
* @type int $instance_number Order in which this instance was created in relation * @type int $instance_number Order in which this instance was created in relation
* to other instances. * to other instances.

View File

@ -3160,7 +3160,7 @@ final class WP_Customize_Manager {
* @param string $cap Capability name. * @param string $cap Capability name.
* @param int $user_id The user ID. * @param int $user_id The user ID.
* @param array $args Adds the context to the cap. Typically the object ID. * @param array $args Adds the context to the cap. Typically the object ID.
* @return array Capabilities. * @return array Capabilities.
*/ */
public function grant_edit_post_capability_for_changeset( $caps, $cap, $user_id, $args ) { public function grant_edit_post_capability_for_changeset( $caps, $cap, $user_id, $args ) {
if ( 'edit_post' === $cap && ! empty( $args[0] ) && 'customize_changeset' === get_post_type( $args[0] ) ) { if ( 'edit_post' === $cap && ! empty( $args[0] ) && 'customize_changeset' === get_post_type( $args[0] ) ) {
@ -3356,7 +3356,6 @@ final class WP_Customize_Manager {
* @param bool $post_has_changed Whether the post has changed. * @param bool $post_has_changed Whether the post has changed.
* @param WP_Post $last_revision The last revision post object. * @param WP_Post $last_revision The last revision post object.
* @param WP_Post $post The post object. * @param WP_Post $post The post object.
*
* @return bool Whether a revision should be made. * @return bool Whether a revision should be made.
*/ */
public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) { public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) {
@ -3680,27 +3679,14 @@ final class WP_Customize_Manager {
* @since 3.4.0 * @since 3.4.0
* @since 4.5.0 Return added WP_Customize_Setting instance. * @since 4.5.0 Return added WP_Customize_Setting instance.
* *
* @see WP_Customize_Setting::__construct()
* @link https://developer.wordpress.org/themes/customize-api * @link https://developer.wordpress.org/themes/customize-api
* *
* @param WP_Customize_Setting|string $id Customize Setting object, or ID. * @param WP_Customize_Setting|string $id Customize Setting object, or ID.
* @param array $args { * @param array $args Optional. Array of properties for the new Setting object.
* Optional. Array of properties for the new WP_Customize_Setting. Default empty array. * See WP_Customize_Setting::__construct() for information
* * on accepted arguments. Default empty array.
* @type string $type Type of the setting. Default 'theme_mod'. * @return WP_Customize_Setting The instance of the setting that was added.
* @type string $capability Capability required for the setting. Default 'edit_theme_options'
* @type string|array $theme_supports Theme features required to support the panel. Default is none.
* @type string $default Default value for the setting. Default is empty string.
* @type string $transport Options for rendering the live preview of changes in Customizer.
* Using 'refresh' makes the change visible by reloading the whole preview.
* Using 'postMessage' allows a custom JavaScript to handle live changes.
* Default is 'refresh'.
* @type callable $validate_callback Server-side validation callback for the setting's value.
* @type callable $sanitize_callback Callback to filter a Customize setting value in un-slashed form.
* @type callable $sanitize_js_callback Callback to convert a Customize PHP setting value to a value that is
* JSON serializable.
* @type bool $dirty Whether or not the setting is initially dirty when created.
* }
* @return WP_Customize_Setting The instance of the setting that was added.
*/ */
public function add_setting( $id, $args = array() ) { public function add_setting( $id, $args = array() ) {
if ( $id instanceof WP_Customize_Setting ) { if ( $id instanceof WP_Customize_Setting ) {
@ -3827,7 +3813,7 @@ final class WP_Customize_Manager {
* @type string $type Type of the panel. * @type string $type Type of the panel.
* @type callable $active_callback Active callback. * @type callable $active_callback Active callback.
* } * }
* @return WP_Customize_Panel The instance of the panel that was added. * @return WP_Customize_Panel The instance of the panel that was added.
*/ */
public function add_panel( $id, $args = array() ) { public function add_panel( $id, $args = array() ) {
if ( $id instanceof WP_Customize_Panel ) { if ( $id instanceof WP_Customize_Panel ) {
@ -3925,7 +3911,7 @@ final class WP_Customize_Manager {
* @type callable $active_callback Active callback. * @type callable $active_callback Active callback.
* @type bool $description_hidden Hide the description behind a help icon, instead of inline above the first control. Default false. * @type bool $description_hidden Hide the description behind a help icon, instead of inline above the first control. Default false.
* } * }
* @return WP_Customize_Section The instance of the section that was added. * @return WP_Customize_Section The instance of the section that was added.
*/ */
public function add_section( $id, $args = array() ) { public function add_section( $id, $args = array() ) {
if ( $id instanceof WP_Customize_Section ) { if ( $id instanceof WP_Customize_Section ) {
@ -4004,7 +3990,7 @@ final class WP_Customize_Manager {
* @param array $args Optional. Array of properties for the new Control object. * @param array $args Optional. Array of properties for the new Control object.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. Default empty array. * on accepted arguments. Default empty array.
* @return WP_Customize_Control The instance of the control that was added. * @return WP_Customize_Control The instance of the control that was added.
*/ */
public function add_control( $id, $args = array() ) { public function add_control( $id, $args = array() ) {
if ( $id instanceof WP_Customize_Control ) { if ( $id instanceof WP_Customize_Control ) {

View File

@ -156,7 +156,23 @@ class WP_Customize_Setting {
* @param WP_Customize_Manager $manager Customizer bootstrap instance. * @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id A specific ID of the setting. * @param string $id A specific ID of the setting.
* Can be a theme mod or option name. * Can be a theme mod or option name.
* @param array $args Setting arguments. * @param array $args {
* Optional. Array of properties for the new Setting object. Default empty array.
*
* @type string $type Type of the setting. Default 'theme_mod'.
* @type string $capability Capability required for the setting. Default 'edit_theme_options'
* @type string|array $theme_supports Theme features required to support the panel. Default is none.
* @type string $default Default value for the setting. Default is empty string.
* @type string $transport Options for rendering the live preview of changes in Customizer.
* Using 'refresh' makes the change visible by reloading the whole preview.
* Using 'postMessage' allows a custom JavaScript to handle live changes.
* Default is 'refresh'.
* @type callable $validate_callback Server-side validation callback for the setting's value.
* @type callable $sanitize_callback Callback to filter a Customize setting value in un-slashed form.
* @type callable $sanitize_js_callback Callback to convert a Customize PHP setting value to a value that is
* JSON serializable.
* @type bool $dirty Whether or not the setting is initially dirty when created.
* }
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {
$keys = array_keys( get_object_vars( $this ) ); $keys = array_keys( get_object_vars( $this ) );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-beta3-47383'; $wp_version = '5.4-beta3-47384';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.