Changeset 32658 for trunk/src/wp-includes/class-wp-customize-section.php
- Timestamp:
- 05/30/2015 12:02:13 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-section.php
r32650 r32658 224 224 */ 225 225 public function json() { 226 $array = wp_array_slice_assoc( (array) $this, array( ' title', 'description', 'priority', 'panel', 'type' ) );226 $array = wp_array_slice_assoc( (array) $this, array( 'id', 'title', 'description', 'priority', 'panel', 'type' ) ); 227 227 $array['content'] = $this->get_content(); 228 228 $array['active'] = $this->active(); 229 229 $array['instanceNumber'] = $this->instance_number; 230 231 if ( $this->panel ) { 232 /* translators: ▸ is the unicode right-pointing triangle, and %s is the section title in the Customizer */ 233 $array['customizeAction'] = sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); 234 } else { 235 $array['customizeAction'] = __( 'Customizing' ); 236 } 237 230 238 return $array; 231 239 } … … 252 260 253 261 /** 254 * Get the section's content templatefor insertion into the Customizer pane.262 * Get the section's content for insertion into the Customizer pane. 255 263 * 256 264 * @since 4.1.0 … … 298 306 299 307 /** 300 * Render the section, and the controls that have been added to it. 301 * 302 * @since 3.4.0 303 */ 304 protected function render() { 305 $classes = 'accordion-section control-section control-section-' . $this->type; 308 * Render the section UI in a subclass. 309 * 310 * Sections are now rendered in JS by default, see {@see WP_Customize_Section::print_template()}. 311 * 312 * @since 3.4.0 313 */ 314 protected function render() {} 315 316 /** 317 * Render the section's JS template. 318 * 319 * This function is only run for section types that have been registered with 320 * {@see WP_Customize_Manager::register_section_type()}. 321 * 322 * @since 4.3.0 323 */ 324 public function print_template() { 325 ?> 326 <script type="text/html" id="tmpl-customize-section-<?php echo $this->type; ?>"> 327 <?php $this->render_template(); ?> 328 </script> 329 <?php 330 } 331 332 /** 333 * An Underscore (JS) template for rendering this section. 334 * 335 * Class variables for this section class are available in the `data` JS object; 336 * export custom variables by overriding {@see WP_Customize_Section::json()}. 337 * 338 * @see WP_Customize_Section::print_template() 339 * 340 * @since 4.3.0 341 */ 342 protected function render_template() { 306 343 ?> 307 <li id="accordion-section- <?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">344 <li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }}"> 308 345 <h3 class="accordion-section-title" tabindex="0"> 309 <?php echo esc_html( $this->title ); ?>346 {{ data.title }} 310 347 <span class="screen-reader-text"><?php _e( 'Press return or enter to open' ); ?></span> 311 348 </h3> … … 317 354 </button> 318 355 <h3> 319 <span class="customize-action"><?php 320 if ( $this->panel ) { 321 /* translators: ▸ is the unicode right-pointing triangle, and %s is the section title in the Customizer */ 322 echo sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); 323 } else { 324 _e( 'Customizing' ); 325 } 326 ?></span> 327 <?php echo esc_html( $this->title ); ?> 356 <span class="customize-action"> 357 {{{ data.customizeAction }}} 358 </span> 359 {{ data.title }} 328 360 </h3> 329 361 </div> 330 < ?php if ( ! empty( $this->description ) ) : ?>331 <p class="description customize-section-description"> <?php echo $this->description; ?></p>332 < ?php endif; ?>362 <# if ( data.description ) { #> 363 <p class="description customize-section-description">{{{ data.description }}}</p> 364 <# } #> 333 365 </li> 334 366 </ul>
Note: See TracChangeset
for help on using the changeset viewer.