diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php index 5ded24ca16..4b7c2ceb73 100644 --- a/wp-includes/class-wp-customize-control.php +++ b/wp-includes/class-wp-customize-control.php @@ -6,25 +6,71 @@ * @subpackage Customize * @since 3.4.0 */ - class WP_Customize_Control { + /** + * @access public + * @var WP_Customize_Manager + */ public $manager; + + /** + * @access public + * @var string + */ public $id; - // All settings tied to the control. + /** + * All settings tied to the control. + * + * @access public + * @var array + */ public $settings; - // The primary setting for the control (if there is one). + /** + * The primary setting for the control (if there is one). + * + * @access public + * @var string + */ public $setting = 'default'; + /** + * @access public + * @var int + */ public $priority = 10; + + /** + * @access public + * @var string + */ public $section = ''; + + /** + * @access public + * @var string + */ public $label = ''; - // @todo: remove choices + + /** + * @todo: Remove choices + * + * @access public + * @var array + */ public $choices = array(); + /** + * @access public + * @var array + */ public $json = array(); + /** + * @access public + * @var string + */ public $type = 'text'; @@ -34,6 +80,10 @@ class WP_Customize_Control { * If $args['settings'] is not defined, use the $id as the setting ID. * * @since 3.4.0 + * + * @param WP_Customize_Manager $manager + * @param string $id + * @param array $args */ function __construct( $manager, $id, $args = array() ) { $keys = array_keys( get_object_vars( $this ) ); @@ -75,6 +125,9 @@ class WP_Customize_Control { * Grabs the main setting by default. * * @since 3.4.0 + * + * @param string $setting_key + * @return mixed The requested setting's value, if the setting exists. */ public final function value( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) ) @@ -119,6 +172,7 @@ class WP_Customize_Control { * Check capabilities and render the control. * * @since 3.4.0 + * @uses WP_Customize_Control::render() */ public final function maybe_render() { if ( ! $this->check_capabilities() ) @@ -143,14 +197,30 @@ class WP_Customize_Control { render_content(); ?> settings[ $setting_key ] ) ) return ''; return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; } - + + /** + * Render the data link parameter for a setting + * + * @since 3.4.0 + * @uses WP_Customize_Control::get_link() + * + * @param string $setting_key + */ public function link( $setting_key = 'default' ) { echo $this->get_link( $setting_key ); } @@ -238,25 +308,69 @@ class WP_Customize_Control { } } +/** + * Customize Color Control Class + * + * @package WordPress + * @subpackage Customize + * @since 3.4.0 + */ class WP_Customize_Color_Control extends WP_Customize_Control { + /** + * @access public + * @var string + */ public $type = 'color'; + + /** + * @access public + * @var array + */ public $statuses; + /** + * Constructor. + * + * If $args['settings'] is not defined, use the $id as the setting ID. + * + * @since 3.4.0 + * @uses WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager + * @param string $id + * @param array $args + */ public function __construct( $manager, $id, $args = array() ) { $this->statuses = array( '' => __('Default') ); parent::__construct( $manager, $id, $args ); } + /** + * Enqueue control related scripts/styles. + * + * @since 3.4.0 + */ public function enqueue() { wp_enqueue_script( 'farbtastic' ); wp_enqueue_style( 'farbtastic' ); } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 3.4.0 + * @uses WP_Customize_Control::to_json() + */ public function to_json() { parent::to_json(); $this->json['statuses'] = $this->statuses; } + /** + * Render the control's content. + * + * @since 3.4.0 + */ public function render_content() { ?>