Inline documentation for hooks in wp-includes/class-wp-customize-setting.php.

Props kpdesign for the cleanup.
Fixes #27295

Built from https://develop.svn.wordpress.org/trunk@27432


git-svn-id: http://core.svn.wordpress.org/trunk@27279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2014-03-06 14:04:13 +00:00
parent 277d715d9e
commit 5ac55b9b1a
1 changed files with 63 additions and 0 deletions

View File

@ -122,6 +122,15 @@ class WP_Customize_Setting {
} }
break; break;
default : default :
/**
* Fires when the WP_Customize_Setting::preview() method is called for settings
* not handled as theme_mods or options.
*
* The dynamic portion of the hook name, $this->id, refers to the setting ID.
*
* @since 3.4.0
*/
do_action( 'customize_preview_' . $this->id ); do_action( 'customize_preview_' . $this->id );
} }
} }
@ -153,6 +162,15 @@ class WP_Customize_Setting {
if ( ! $this->check_capabilities() || ! isset( $value ) ) if ( ! $this->check_capabilities() || ! isset( $value ) )
return false; return false;
/**
* Fires when the WP_Customize_Setting::save() method is called for settings
* not handled as theme_mods or options.
*
* The dynamic portion of the hook name, $this->id_data['base'] refers to
* the base slug of the setting name.
*
* @since 3.4.0
*/
do_action( 'customize_save_' . $this->id_data[ 'base' ] ); do_action( 'customize_save_' . $this->id_data[ 'base' ] );
$this->update( $value ); $this->update( $value );
@ -190,6 +208,15 @@ class WP_Customize_Setting {
*/ */
public function sanitize( $value ) { public function sanitize( $value ) {
$value = wp_unslash( $value ); $value = wp_unslash( $value );
/**
* Filter a Customize setting value in un-slashed form.
*
* @since 3.4.0
*
* @param mixed $value Value of the setting.
* @param WP_Customize_Setting $this WP_Customize_Setting instance.
*/
return apply_filters( "customize_sanitize_{$this->id}", $value, $this ); return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
} }
@ -210,6 +237,17 @@ class WP_Customize_Setting {
return $this->_update_option( $value ); return $this->_update_option( $value );
break; break;
default : default :
/**
* Fires when the WP_Customize_Setting::update() method is called for settings
* not handled as theme_mods or options.
*
* The dynamic portion of the hook name, $this->type, refers to the type of setting.
*
* @since 3.4.0
*
* @param mixed $value Value of the setting.
*/
return do_action( 'customize_update_' . $this->type, $value ); return do_action( 'customize_update_' . $this->type, $value );
} }
} }
@ -271,6 +309,20 @@ class WP_Customize_Setting {
$function = 'get_option'; $function = 'get_option';
break; break;
default : default :
/**
* Filter a Customize setting value not handled as a theme_mod or option.
*
* The dynamic portion of the hook name, $this->id_date['base'], refers to
* the base slug of the setting name.
*
* For settings handled as theme_mods or options, see those corresponding
* functions for available hooks.
*
* @since 3.4.0
*
* @param mixed $default The setting default value. Default empty.
*/
return apply_filters( 'customize_value_' . $this->id_data[ 'base' ], $this->default ); return apply_filters( 'customize_value_' . $this->id_data[ 'base' ], $this->default );
} }
@ -291,6 +343,17 @@ class WP_Customize_Setting {
* @return mixed The requested escaped value. * @return mixed The requested escaped value.
*/ */
public function js_value() { public function js_value() {
/**
* Filter a Customize setting value for use in JavaScript.
*
* The dynamic portion of the hook name, $this->id, refers to the setting ID.
*
* @since 3.4.0
*
* @param mixed $value The setting value.
* @param WP_Customize_Setting $this WP_Customize_Setting instance.
*/
$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this ); $value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );
if ( is_string( $value ) ) if ( is_string( $value ) )