From 8c5a8f1811828f1e372e2475aa46ce80a4422dbe Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 27 Feb 2020 20:09:06 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-customize-control.php | 2 +- wp-includes/class-wp-customize-manager.php | 32 ++++++---------------- wp-includes/class-wp-customize-setting.php | 18 +++++++++++- wp-includes/version.php | 2 +- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php index c97b24d071..f01d82b827 100644 --- a/wp-includes/class-wp-customize-control.php +++ b/wp-includes/class-wp-customize-control.php @@ -174,7 +174,7 @@ class WP_Customize_Control { * @param WP_Customize_Manager $manager Customizer bootstrap instance. * @param string $id Control ID. * @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 * to other instances. diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 473e1fb247..659b1cba9f 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -3160,7 +3160,7 @@ final class WP_Customize_Manager { * @param string $cap Capability name. * @param int $user_id The user 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 ) { 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 WP_Post $last_revision The last revision post object. * @param WP_Post $post The post object. - * * @return bool Whether a revision should be made. */ 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 4.5.0 Return added WP_Customize_Setting instance. * + * @see WP_Customize_Setting::__construct() * @link https://developer.wordpress.org/themes/customize-api * * @param WP_Customize_Setting|string $id Customize Setting object, or ID. - * @param array $args { - * Optional. Array of properties for the new WP_Customize_Setting. 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. - * } - * @return WP_Customize_Setting The instance of the setting that was added. + * @param array $args Optional. Array of properties for the new Setting object. + * See WP_Customize_Setting::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Setting The instance of the setting that was added. */ public function add_setting( $id, $args = array() ) { if ( $id instanceof WP_Customize_Setting ) { @@ -3827,7 +3813,7 @@ final class WP_Customize_Manager { * @type string $type Type of the panel. * @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() ) { if ( $id instanceof WP_Customize_Panel ) { @@ -3925,7 +3911,7 @@ final class WP_Customize_Manager { * @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. * } - * @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() ) { 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. * See WP_Customize_Control::__construct() for information * 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() ) { if ( $id instanceof WP_Customize_Control ) { diff --git a/wp-includes/class-wp-customize-setting.php b/wp-includes/class-wp-customize-setting.php index ee5a1db3d3..10a24afed8 100644 --- a/wp-includes/class-wp-customize-setting.php +++ b/wp-includes/class-wp-customize-setting.php @@ -156,7 +156,23 @@ class WP_Customize_Setting { * @param WP_Customize_Manager $manager Customizer bootstrap instance. * @param string $id A specific ID of the setting. * 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() ) { $keys = array_keys( get_object_vars( $this ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 4fc5dfce1a..3494f94158 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @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.