Changeset 35385 for trunk/src/wp-includes/class-wp-customize-section.php
- Timestamp:
- 10/24/2015 06:20:25 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-section.php
r35232 r35385 375 375 } 376 376 377 /** 378 * Customize Themes Section class. 379 * 380 * A UI container for theme controls, which behaves like a backwards Panel. 381 * 382 * @since 4.2.0 383 * 384 * @see WP_Customize_Section 385 */ 386 class WP_Customize_Themes_Section extends WP_Customize_Section { 387 388 /** 389 * Customize section type. 390 * 391 * @since 4.2.0 392 * @access public 393 * @var string 394 */ 395 public $type = 'themes'; 396 397 /** 398 * Render the themes section, which behaves like a panel. 399 * 400 * @since 4.2.0 401 * @access protected 402 */ 403 protected function render() { 404 $classes = 'accordion-section control-section control-section-' . $this->type; 405 ?> 406 <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> 407 <h3 class="accordion-section-title"> 408 <?php 409 if ( $this->manager->is_theme_active() ) { 410 echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title; 411 } else { 412 echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title; 413 } 414 ?> 415 416 <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button> 417 </h3> 418 <div class="customize-themes-panel control-panel-content themes-php"> 419 <h3 class="accordion-section-title customize-section-title"> 420 <span class="customize-action"><?php _e( 'Customizing' ); ?></span> 421 <?php _e( 'Themes' ); ?> 422 <span class="title-count theme-count"><?php echo count( $this->controls ) + 1 /* Active theme */; ?></span> 423 </h3> 424 <h3 class="accordion-section-title customize-section-title"> 425 <?php 426 if ( $this->manager->is_theme_active() ) { 427 echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title; 428 } else { 429 echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title; 430 } 431 ?> 432 <button type="button" class="button customize-theme"><?php _e( 'Customize' ); ?></button> 433 </h3> 434 435 <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div> 436 437 <div id="customize-container"></div> 438 <?php if ( count( $this->controls ) > 4 ) : ?> 439 <p><label for="themes-filter"> 440 <span class="screen-reader-text"><?php _e( 'Search installed themes…' ); ?></span> 441 <input type="text" id="themes-filter" placeholder="<?php esc_attr_e( 'Search installed themes…' ); ?>" /> 442 </label></p> 443 <?php endif; ?> 444 <div class="theme-browser rendered"> 445 <ul class="themes accordion-section-content"> 446 </ul> 447 </div> 448 </div> 449 </li> 450 <?php } 451 } 452 453 /** 454 * Customizer section representing widget area (sidebar). 455 * 456 * @since 4.1.0 457 * 458 * @see WP_Customize_Section 459 */ 460 class WP_Customize_Sidebar_Section extends WP_Customize_Section { 461 462 /** 463 * Type of this section. 464 * 465 * @since 4.1.0 466 * @access public 467 * @var string 468 */ 469 public $type = 'sidebar'; 470 471 /** 472 * Unique identifier. 473 * 474 * @since 4.1.0 475 * @access public 476 * @var string 477 */ 478 public $sidebar_id; 479 480 /** 481 * Gather the parameters passed to client JavaScript via JSON. 482 * 483 * @since 4.1.0 484 * 485 * @return array The array to be exported to the client as JSON. 486 */ 487 public function json() { 488 $json = parent::json(); 489 $json['sidebarId'] = $this->sidebar_id; 490 return $json; 491 } 492 493 /** 494 * Whether the current sidebar is rendered on the page. 495 * 496 * @since 4.1.0 497 * @access public 498 * 499 * @return bool Whether sidebar is rendered. 500 */ 501 public function active_callback() { 502 return $this->manager->widgets->is_sidebar_rendered( $this->sidebar_id ); 503 } 504 } 505 506 /** 507 * Customize Menu Section Class 508 * 509 * Custom section only needed in JS. 510 * 511 * @since 4.3.0 512 * 513 * @see WP_Customize_Section 514 */ 515 class WP_Customize_Nav_Menu_Section extends WP_Customize_Section { 516 517 /** 518 * Control type. 519 * 520 * @since 4.3.0 521 * @access public 522 * @var string 523 */ 524 public $type = 'nav_menu'; 525 526 /** 527 * Get section parameters for JS. 528 * 529 * @since 4.3.0 530 * @access public 531 * @return array Exported parameters. 532 */ 533 public function json() { 534 $exported = parent::json(); 535 $exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(\d+)\]/', '$1', $this->id ) ); 536 537 return $exported; 538 } 539 } 540 541 /** 542 * Customize Menu Section Class 543 * 544 * Implements the new-menu-ui toggle button instead of a regular section. 545 * 546 * @since 4.3.0 547 * 548 * @see WP_Customize_Section 549 */ 550 class WP_Customize_New_Menu_Section extends WP_Customize_Section { 551 552 /** 553 * Control type. 554 * 555 * @since 4.3.0 556 * @access public 557 * @var string 558 */ 559 public $type = 'new_menu'; 560 561 /** 562 * Render the section, and the controls that have been added to it. 563 * 564 * @since 4.3.0 565 * @access protected 566 */ 567 protected function render() { 568 ?> 569 <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu"> 570 <button type="button" class="button-secondary add-new-menu-item add-menu-toggle" aria-expanded="false"> 571 <?php echo esc_html( $this->title ); ?> 572 </button> 573 <ul class="new-menu-section-content"></ul> 574 </li> 575 <?php 576 } 577 } 377 /** WP_Customize_Themes_Section class */ 378 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' ); 379 380 /** WP_Customize_Sidebar_Section class */ 381 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' ); 382 383 /** WP_Customize_Nav_Menu_Section class */ 384 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' ); 385 386 /** WP_Customize_New_Menu_Section class */ 387 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' );
Note: See TracChangeset
for help on using the changeset viewer.