Make WordPress Core


Ignore:
Timestamp:
12/06/2015 06:09:42 PM (9 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r35724 r35781  
    10381038     *
    10391039     * @since 3.4.0
    1040      *
    1041      * @param WP_Customize_Setting|string $id Customize Setting object, or ID.
    1042      * @param array $args                     Setting arguments; passed to WP_Customize_Setting
    1043      *                                        constructor.
     1040     * @since 4.5.0 Return added WP_Customize_Setting instance.
     1041     * @access public
     1042     *
     1043     * @param WP_Customize_Setting|string $id   Customize Setting object, or ID.
     1044     * @param array                       $args Setting arguments; passed to WP_Customize_Setting
     1045     *                                          constructor.
     1046     * @return WP_Customize_Setting             The instance of the setting that was added.
    10441047     */
    10451048    public function add_setting( $id, $args = array() ) {
     
    10491052            $setting = new WP_Customize_Setting( $this, $id, $args );
    10501053        }
     1054
    10511055        $this->settings[ $setting->id ] = $setting;
     1056        return $setting;
    10521057    }
    10531058
     
    10621067     *
    10631068     * @since 4.2.0
     1069     * @access public
    10641070     *
    10651071     * @param array $setting_ids The setting IDs to add.
     
    11421148     *
    11431149     * @since 4.0.0
     1150     * @since 4.5.0 Return added WP_Customize_Panel instance.
    11441151     * @access public
    11451152     *
    11461153     * @param WP_Customize_Panel|string $id   Customize Panel object, or Panel ID.
    11471154     * @param array                     $args Optional. Panel arguments. Default empty array.
     1155     *
     1156     * @return WP_Customize_Panel             The instance of the panel that was added.
    11481157     */
    11491158    public function add_panel( $id, $args = array() ) {
     
    11551164
    11561165        $this->panels[ $panel->id ] = $panel;
     1166        return $panel;
    11571167    }
    11581168
     
    12171227     *
    12181228     * @since 3.4.0
     1229     * @since 4.5.0 Return added WP_Customize_Section instance.
     1230     * @access public
    12191231     *
    12201232     * @param WP_Customize_Section|string $id   Customize Section object, or Section ID.
    12211233     * @param array                       $args Section arguments.
     1234     *
     1235     * @return WP_Customize_Section             The instance of the section that was added.
    12221236     */
    12231237    public function add_section( $id, $args = array() ) {
     
    12271241            $section = new WP_Customize_Section( $this, $id, $args );
    12281242        }
     1243
    12291244        $this->sections[ $section->id ] = $section;
     1245        return $section;
    12301246    }
    12311247
     
    12871303     *
    12881304     * @since 3.4.0
     1305     * @since 4.5.0 Return added WP_Customize_Control instance.
     1306     * @access public
    12891307     *
    12901308     * @param WP_Customize_Control|string $id   Customize Control object, or ID.
    12911309     * @param array                       $args Control arguments; passed to WP_Customize_Control
    12921310     *                                          constructor.
     1311     * @return WP_Customize_Control             The instance of the control that was added.
    12931312     */
    12941313    public function add_control( $id, $args = array() ) {
     
    12981317            $control = new WP_Customize_Control( $this, $id, $args );
    12991318        }
     1319
    13001320        $this->controls[ $control->id ] = $control;
     1321        return $control;
    13011322    }
    13021323
Note: See TracChangeset for help on using the changeset viewer.