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

Props kpdesign for the cleanup.
Fixes #27295


git-svn-id: https://develop.svn.wordpress.org/trunk@27432 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes
2014-03-06 14:03:23 +00:00
parent 6ec45726ac
commit ce4ed49390

View File

@@ -122,6 +122,15 @@ class WP_Customize_Setting {
}
break;
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 );
}
}
@@ -153,6 +162,15 @@ class WP_Customize_Setting {
if ( ! $this->check_capabilities() || ! isset( $value ) )
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' ] );
$this->update( $value );
@@ -190,6 +208,15 @@ class WP_Customize_Setting {
*/
public function sanitize( $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 );
}
@@ -210,6 +237,17 @@ class WP_Customize_Setting {
return $this->_update_option( $value );
break;
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 );
}
}
@@ -271,6 +309,20 @@ class WP_Customize_Setting {
$function = 'get_option';
break;
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 );
}
@@ -291,6 +343,17 @@ class WP_Customize_Setting {
* @return mixed The requested escaped 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 );
if ( is_string( $value ) )