Ticket #21303: diff.patch
File diff.patch, 2.9 KB (added by , 12 years ago) |
---|
-
wp-includes/class-wp-customize-control.php
6 6 * @subpackage Customize 7 7 * @since 3.4.0 8 8 */ 9 10 9 class WP_Customize_Control { 10 /** 11 * @access public 12 * @var WP_Customize_Manager 13 */ 11 14 public $manager; 15 16 /** 17 * @access public 18 * @var int 19 */ 12 20 public $id; 13 21 14 // All settings tied to the control. 22 /** 23 * All settings tied to the control. 24 * 25 * @access public 26 * @var array 27 */ 15 28 public $settings; 16 29 17 // The primary setting for the control (if there is one). 30 /** 31 * The primary setting for the control (if there is one). 32 * 33 * @access public 34 * @var string 35 */ 18 36 public $setting = 'default'; 19 37 38 /** 39 * @access public 40 * @var int 41 */ 20 42 public $priority = 10; 43 44 /** 45 * @access public 46 * @var string 47 */ 21 48 public $section = ''; 49 50 /** 51 * @access public 52 * @var string 53 */ 22 54 public $label = ''; 23 // @todo: remove choices 55 56 /** 57 * @todo: Remove choices 58 * 59 * @access public 60 * @var array 61 */ 24 62 public $choices = array(); 25 63 64 /** 65 * @access public 66 * @var array 67 */ 26 68 public $json = array(); 27 69 70 /** 71 * @access public 72 * @var string 73 */ 28 74 public $type = 'text'; 29 75 30 76 … … 34 80 * If $args['settings'] is not defined, use the $id as the setting ID. 35 81 * 36 82 * @since 3.4.0 83 * 84 * @param WP_Customize_Manager $manager 85 * @param int $id 86 * @param array $args 37 87 */ 38 88 function __construct( $manager, $id, $args = array() ) { 39 89 $keys = array_keys( get_object_vars( $this ) ); … … 75 125 * Grabs the main setting by default. 76 126 * 77 127 * @since 3.4.0 128 * 129 * @param string $setting_key 130 * @return mixed The requested setting's value, if the setting exists. 78 131 */ 79 132 public final function value( $setting_key = 'default' ) { 80 133 if ( isset( $this->settings[ $setting_key ] ) ) … … 119 172 * Check capabilities and render the control. 120 173 * 121 174 * @since 3.4.0 175 * @see render() 122 176 */ 123 177 public final function maybe_render() { 124 178 if ( ! $this->check_capabilities() ) … … 143 197 <?php $this->render_content(); ?> 144 198 </li><?php 145 199 } 146 200 201 /** 202 * Get the data link parameter for a setting. 203 * 204 * @since 3.4.0 205 * 206 * @param string $setting_key 207 * @return string Data link parameter, if $setting_key is a valid setting, empty string otherwise. 208 */ 147 209 public function get_link( $setting_key = 'default' ) { 148 210 if ( ! isset( $this->settings[ $setting_key ] ) ) 149 211 return ''; 150 212 151 213 return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; 152 214 } 153 215 216 /** 217 * Render the data link parameter for a setting 218 * 219 * @since 3.4.0 220 * @see get_link() 221 * 222 * @param string $setting_key 223 */ 154 224 public function link( $setting_key = 'default' ) { 155 225 echo $this->get_link( $setting_key ); 156 226 }