Make WordPress Core


Ignore:
Timestamp:
10/05/2015 09:57:32 PM (11 years ago)
Author:
westonruter
Message:

Customizer: Ensure WP_Customize_Setting::update() returns boolean value.

Adds unit tests for WP_Customize_Setting::save() (and WP_Customize_Setting::update()), along with the actions customize_update_{$type}, and customize_save_{$id_base} which they trigger.

Fixes #34140.

File:
1 edited

Legend:

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

    r33911 r34838  
    305305         *
    306306         * @param mixed $value The value to update.
    307          * @return mixed The result of saving the value.
     307         * @return bool The result of saving the value.
    308308         */
    309309        protected function update( $value ) {
    310                 switch( $this->type ) {
     310                switch ( $this->type ) {
    311311                        case 'theme_mod' :
    312                                 return $this->_update_theme_mod( $value );
     312                                $this->_update_theme_mod( $value );
     313                                return true;
    313314
    314315                        case 'option' :
     
    328329                                 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
    329330                                 */
    330                                 return do_action( 'customize_update_' . $this->type, $value, $this );
     331                                do_action( "customize_update_{$this->type}", $value, $this );
     332
     333                                return has_action( "customize_update_{$this->type}" );
    331334                }
    332335        }
Note: See TracChangeset for help on using the changeset viewer.