Changeset 32658 for trunk/src/wp-includes/class-wp-customize-panel.php
- Timestamp:
- 05/30/2015 12:02:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-panel.php
r32650 r32658 215 215 */ 216 216 public function json() { 217 $array = wp_array_slice_assoc( (array) $this, array( ' title', 'description', 'priority', 'type' ) );217 $array = wp_array_slice_assoc( (array) $this, array( 'id', 'title', 'description', 'priority', 'type' ) ); 218 218 $array['content'] = $this->get_content(); 219 219 $array['active'] = $this->active(); … … 290 290 291 291 /** 292 * Render the panel container, and then its contents. 292 * Render the panel container, and then its contents (via `this->render_content()`) in a subclass. 293 * 294 * Panel containers are now rendered in JS by default, see {@see WP_Customize_Panel::print_template()}. 293 295 * 294 296 * @since 4.0.0 295 297 * @access protected 296 298 */ 297 protected function render() { 298 $classes = 'accordion-section control-section control-panel control-panel-' . $this->type; 299 protected function render() {} 300 301 /** 302 * Render the panel UI in a subclass. 303 * 304 * Panel contents are now rendered in JS by default, see {@see WP_Customize_Panel::print_template()}. 305 * 306 * @since 4.1.0 307 * @access protected 308 */ 309 protected function render_content() {} 310 311 /** 312 * Render the panel's JS templates. 313 * 314 * This function is only run for panel types that have been registered with 315 * {@see WP_Customize_Manager::register_panel_type()}. 316 * 317 * @since 4.3.0 318 */ 319 public function print_template() { 299 320 ?> 300 <li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> 321 <script type="text/html" id="tmpl-customize-panel-<?php echo esc_attr( $this->type ); ?>-content"> 322 <?php $this->content_template(); ?> 323 </script> 324 <script type="text/html" id="tmpl-customize-panel-<?php echo esc_attr( $this->type ); ?>"> 325 <?php $this->render_template(); ?> 326 </script> 327 <?php 328 } 329 330 /** 331 * An Underscore (JS) template for rendering this panel's container. 332 * 333 * Class variables for this panel class are available in the `data` JS object; 334 * export custom variables by overriding {@see WP_Customize_Panel::json()}. 335 * 336 * @see WP_Customize_Panel::print_template() 337 * 338 * @since 4.3.0 339 */ 340 protected function render_template() { 341 ?> 342 <li id="accordion-panel-{{ data.id }}" class="accordion-section control-section control-panel control-panel-{{ data.type }}"> 301 343 <h3 class="accordion-section-title" tabindex="0"> 302 <?php echo esc_html( $this->title ); ?>344 {{ data.title }} 303 345 <span class="screen-reader-text"><?php _e( 'Press return or enter to open this panel' ); ?></span> 304 346 </h3> 305 <ul class="accordion-sub-container control-panel-content"> 306 <?php $this->render_content(); ?> 307 </ul> 347 <ul class="accordion-sub-container control-panel-content"></ul> 308 348 </li> 309 349 <?php … … 311 351 312 352 /** 313 * Render the sections that have been added to the panel. 314 * 315 * @since 4.1.0 316 * @access protected 317 */ 318 protected function render_content() { 353 * An Underscore (JS) template for this panel's content (but not its container). 354 * 355 * Class variables for this panel class are available in the `data` JS object; 356 * export custom variables by overriding {@see WP_Customize_Panel::json()}. 357 * 358 * @see WP_Customize_Panel::print_template() 359 * 360 * @since 4.3.0 361 */ 362 protected function content_template() { 319 363 ?> 320 <li class="panel-meta customize-info accordion-section <?php if ( empty( $this->description ) ) { echo ' cannot-expand'; } ?>">364 <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>"> 321 365 <button class="customize-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></button> 322 366 <div class="accordion-section-title"> 323 367 <span class="preview-notice"><?php 324 368 /* translators: %s is the site/panel title in the Customizer */ 325 echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title"> ' . esc_html( $this->title ) . '</strong>' );369 echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' ); 326 370 ?></span> 327 371 <button class="customize-help-toggle dashicons dashicons-editor-help" tabindex="0" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> 328 372 </div> 329 < ?php if ( ! empty( $this->description ) ) : ?>373 <# if ( data.description ) { #> 330 374 <div class="description customize-panel-description"> 331 <?php echo $this->description; ?>375 {{{ data.description }}} 332 376 </div> 333 < ?php endif; ?>377 <# } #> 334 378 </li> 335 379 <?php
Note: See TracChangeset
for help on using the changeset viewer.