Customizer: Return added instances for panels, sections, controls, and settings when calling `WP_Customize_Manager::add_*()` methods.
Add missing phpDoc. Props fusillicode, jubstuff. Fixes #34596. Built from https://develop.svn.wordpress.org/trunk@35781 git-svn-id: http://core.svn.wordpress.org/trunk@35745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
446de48b4f
commit
0c311ef2d6
|
@ -1037,10 +1037,13 @@ final class WP_Customize_Manager {
|
||||||
* Add a customize setting.
|
* Add a customize setting.
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
|
* @since 4.5.0 Return added WP_Customize_Setting instance.
|
||||||
|
* @access public
|
||||||
*
|
*
|
||||||
* @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 Setting arguments; passed to WP_Customize_Setting
|
* @param array $args Setting arguments; passed to WP_Customize_Setting
|
||||||
* constructor.
|
* constructor.
|
||||||
|
* @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 ) {
|
||||||
|
@ -1048,7 +1051,9 @@ final class WP_Customize_Manager {
|
||||||
} else {
|
} else {
|
||||||
$setting = new WP_Customize_Setting( $this, $id, $args );
|
$setting = new WP_Customize_Setting( $this, $id, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->settings[ $setting->id ] = $setting;
|
$this->settings[ $setting->id ] = $setting;
|
||||||
|
return $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1061,6 +1066,7 @@ final class WP_Customize_Manager {
|
||||||
* even though they are not directly created statically with code.
|
* even though they are not directly created statically with code.
|
||||||
*
|
*
|
||||||
* @since 4.2.0
|
* @since 4.2.0
|
||||||
|
* @access public
|
||||||
*
|
*
|
||||||
* @param array $setting_ids The setting IDs to add.
|
* @param array $setting_ids The setting IDs to add.
|
||||||
* @return array The WP_Customize_Setting objects added.
|
* @return array The WP_Customize_Setting objects added.
|
||||||
|
@ -1141,10 +1147,13 @@ final class WP_Customize_Manager {
|
||||||
* Add a customize panel.
|
* Add a customize panel.
|
||||||
*
|
*
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
|
* @since 4.5.0 Return added WP_Customize_Panel instance.
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
* @param WP_Customize_Panel|string $id Customize Panel object, or Panel ID.
|
* @param WP_Customize_Panel|string $id Customize Panel object, or Panel ID.
|
||||||
* @param array $args Optional. Panel arguments. Default empty array.
|
* @param array $args Optional. Panel arguments. Default empty array.
|
||||||
|
*
|
||||||
|
* @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 ) {
|
||||||
|
@ -1154,6 +1163,7 @@ final class WP_Customize_Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->panels[ $panel->id ] = $panel;
|
$this->panels[ $panel->id ] = $panel;
|
||||||
|
return $panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1216,9 +1226,13 @@ final class WP_Customize_Manager {
|
||||||
* Add a customize section.
|
* Add a customize section.
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
|
* @since 4.5.0 Return added WP_Customize_Section instance.
|
||||||
|
* @access public
|
||||||
*
|
*
|
||||||
* @param WP_Customize_Section|string $id Customize Section object, or Section ID.
|
* @param WP_Customize_Section|string $id Customize Section object, or Section ID.
|
||||||
* @param array $args Section arguments.
|
* @param array $args Section arguments.
|
||||||
|
*
|
||||||
|
* @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 ) {
|
||||||
|
@ -1226,7 +1240,9 @@ final class WP_Customize_Manager {
|
||||||
} else {
|
} else {
|
||||||
$section = new WP_Customize_Section( $this, $id, $args );
|
$section = new WP_Customize_Section( $this, $id, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sections[ $section->id ] = $section;
|
$this->sections[ $section->id ] = $section;
|
||||||
|
return $section;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1286,10 +1302,13 @@ final class WP_Customize_Manager {
|
||||||
* Add a customize control.
|
* Add a customize control.
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
|
* @since 4.5.0 Return added WP_Customize_Control instance.
|
||||||
|
* @access public
|
||||||
*
|
*
|
||||||
* @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 Control arguments; passed to WP_Customize_Control
|
* @param array $args Control arguments; passed to WP_Customize_Control
|
||||||
* constructor.
|
* constructor.
|
||||||
|
* @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 ) {
|
||||||
|
@ -1297,7 +1316,9 @@ final class WP_Customize_Manager {
|
||||||
} else {
|
} else {
|
||||||
$control = new WP_Customize_Control( $this, $id, $args );
|
$control = new WP_Customize_Control( $this, $id, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->controls[ $control->id ] = $control;
|
$this->controls[ $control->id ] = $control;
|
||||||
|
return $control;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-35780';
|
$wp_version = '4.5-alpha-35781';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue