Docs: Add a reference to WP_Customize_Control::__construct() for information on accepted arguments in WP_Customize_Manager::add_control().

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

Props hAmpzter, marekdedic, SergeyBiryukov.
Fixes #48343.
Built from https://develop.svn.wordpress.org/trunk@47364


git-svn-id: http://core.svn.wordpress.org/trunk@47151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-25 16:41:07 +00:00
parent cfc27d08ce
commit d51c720d2f
8 changed files with 14 additions and 26 deletions

View File

@ -184,6 +184,8 @@ class WP_Customize_Control {
* be used. * be used.
* @type string $setting The primary setting for the control (if there is one). * @type string $setting The primary setting for the control (if there is one).
* Default 'default'. * Default 'default'.
* @type string $capability Capability required to use this control. Normally this is empty
* and the capability is derived from `$settings`.
* @type int $priority Order priority to load the control. Default 10. * @type int $priority Order priority to load the control. Default 10.
* @type string $section Section the control belongs to. Default empty. * @type string $section Section the control belongs to. Default empty.
* @type string $label Label for the control. Default empty. * @type string $label Label for the control. Default empty.
@ -195,11 +197,14 @@ class WP_Customize_Control {
* attribute names are the keys and values are the values. Not * attribute names are the keys and values are the values. Not
* used for 'checkbox', 'radio', 'select', 'textarea', or * used for 'checkbox', 'radio', 'select', 'textarea', or
* 'dropdown-pages' control types. Default empty array. * 'dropdown-pages' control types. Default empty array.
* @type bool $allow_addition Show UI for adding new content, currently only used for the
* dropdown-pages control. Default false.
* @type array $json Deprecated. Use WP_Customize_Control::json() instead. * @type array $json Deprecated. Use WP_Customize_Control::json() instead.
* @type string $type Control type. Core controls include 'text', 'checkbox', * @type string $type Control type. Core controls include 'text', 'checkbox',
* 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional * 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional
* input types such as 'email', 'url', 'number', 'hidden', and * input types such as 'email', 'url', 'number', 'hidden', and
* 'date' are supported implicitly. Default 'text'. * 'date' are supported implicitly. Default 'text'.
* @type callback $active_callback Active callback.
* } * }
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {

View File

@ -3993,26 +3993,9 @@ final class WP_Customize_Manager {
* @since 4.5.0 Return added WP_Customize_Control instance. * @since 4.5.0 Return added WP_Customize_Control instance.
* *
* @param WP_Customize_Control|string $id Customize Control object, or ID. * @param WP_Customize_Control|string $id Customize Control object, or ID.
* @param array $args { * @param array $args Optional. Array of properties for the new Control object.
* Optional. Array of properties for the new Control object. Default empty array. * See WP_Customize_Control::__construct() for information
* * on accepted arguments. Default empty array.
* @type array $settings All settings tied to the control. If undefined, defaults to `$setting`.
* IDs in the array correspond to the ID of a registered `WP_Customize_Setting`.
* @type string $setting The primary setting for the control (if there is one). Default is 'default'.
* @type string $capability Capability required to use this control. Normally derived from `$settings`.
* @type int $priority Order priority to load the control. Default 10.
* @type string $section The section this control belongs to. Default empty.
* @type string $label Label for the control. Default empty.
* @type string $description Description for the control. Default empty.
* @type array $choices List of choices for 'radio' or 'select' type controls, where values
* are the keys, and labels are the values. Default empty array.
* @type array $input_attrs List of custom input attributes for control output, where attribute
* names are the keys and values are the values. Default empty array.
* @type bool $allow_addition Show UI for adding new content, currently only used for the
* dropdown-pages control. Default false.
* @type string $type The type of the control. Default 'text'.
* @type callback $active_callback Active callback.
* }
* @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() ) {

View File

@ -47,7 +47,7 @@ class WP_Customize_Color_Control extends WP_Customize_Control {
* @param string $id Control ID. * @param string $id Control ID.
* @param array $args Optional. Arguments to override class property defaults. * @param array $args Optional. Arguments to override class property defaults.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. * on accepted arguments. Default empty array.
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {
$this->statuses = array( '' => __( 'Default' ) ); $this->statuses = array( '' => __( 'Default' ) );

View File

@ -49,7 +49,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
* @param string $id Control ID. * @param string $id Control ID.
* @param array $args Optional. Arguments to override class property defaults. * @param array $args Optional. Arguments to override class property defaults.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. * on accepted arguments. Default empty array.
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args ); parent::__construct( $manager, $id, $args );

View File

@ -43,7 +43,7 @@ class WP_Customize_Nav_Menu_Item_Control extends WP_Customize_Control {
* @param string $id The control ID. * @param string $id The control ID.
* @param array $args Optional. Arguments to override class property defaults. * @param array $args Optional. Arguments to override class property defaults.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. * on accepted arguments. Default empty array.
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args ); parent::__construct( $manager, $id, $args );

View File

@ -38,7 +38,7 @@ class WP_Customize_New_Menu_Control extends WP_Customize_Control {
* @param string $id The control ID. * @param string $id The control ID.
* @param array $args Optional. Arguments to override class property defaults. * @param array $args Optional. Arguments to override class property defaults.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. * on accepted arguments. Default empty array.
*/ */
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) { public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
_deprecated_function( __METHOD__, '4.9.0' ); _deprecated_function( __METHOD__, '4.9.0' );

View File

@ -35,7 +35,7 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
* @param string $id Control ID. * @param string $id Control ID.
* @param array $args Optional. Arguments to override class property defaults. * @param array $args Optional. Arguments to override class property defaults.
* See WP_Customize_Control::__construct() for information * See WP_Customize_Control::__construct() for information
* on accepted arguments. * on accepted arguments. Default empty array.
*/ */
public function __construct( $manager, $id, $args = array() ) { public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args ); parent::__construct( $manager, $id, $args );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-beta2-47363'; $wp_version = '5.4-beta2-47364';
/** /**
* 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.