WordPress 4.4
[autoinstalls/wordpress.git] / wp-includes / customize / class-wp-customize-themes-section.php
1 <?php
2 /**
3  * Customize API: WP_Customize_Themes_Section class
4  *
5  * @package WordPress
6  * @subpackage Customize
7  * @since 4.4.0
8  */
9
10 /**
11  * Customize Themes Section class.
12  *
13  * A UI container for theme controls, which behaves like a backwards Panel.
14  *
15  * @since 4.2.0
16  *
17  * @see WP_Customize_Section
18  */
19 class WP_Customize_Themes_Section extends WP_Customize_Section {
20
21         /**
22          * Customize section type.
23          *
24          * @since 4.2.0
25          * @access public
26          * @var string
27          */
28         public $type = 'themes';
29
30         /**
31          * Render the themes section, which behaves like a panel.
32          *
33          * @since 4.2.0
34          * @access protected
35          */
36         protected function render() {
37                 $classes = 'accordion-section control-section control-section-' . $this->type;
38                 ?>
39                 <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
40                         <h3 class="accordion-section-title">
41                                 <?php
42                                 if ( $this->manager->is_theme_active() ) {
43                                         echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title;
44                                 } else {
45                                         echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title;
46                                 }
47                                 ?>
48
49                                 <?php if ( count( $this->controls ) > 1 ) : ?>
50                                         <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button>
51                                 <?php endif; ?>
52                         </h3>
53                         <div class="customize-themes-panel control-panel-content themes-php">
54                                 <h3 class="accordion-section-title customize-section-title">
55                                         <span class="customize-action"><?php _e( 'Customizing' ); ?></span>
56                                         <?php _e( 'Themes' ); ?>
57                                         <span class="title-count theme-count"><?php echo count( $this->controls ) + 1 /* Active theme */; ?></span>
58                                 </h3>
59                                 <h3 class="accordion-section-title customize-section-title">
60                                         <?php
61                                         if ( $this->manager->is_theme_active() ) {
62                                                 echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title;
63                                         } else {
64                                                 echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title;
65                                         }
66                                         ?>
67                                         <button type="button" class="button customize-theme"><?php _e( 'Customize' ); ?></button>
68                                 </h3>
69
70                                 <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
71
72                                 <div id="customize-container"></div>
73                                 <?php if ( count( $this->controls ) > 4 ) : ?>
74                                         <p><label for="themes-filter">
75                                                 <span class="screen-reader-text"><?php _e( 'Search installed themes&hellip;' ); ?></span>
76                                                 <input type="text" id="themes-filter" placeholder="<?php esc_attr_e( 'Search installed themes&hellip;' ); ?>" />
77                                         </label></p>
78                                 <?php endif; ?>
79                                 <div class="theme-browser rendered">
80                                         <ul class="themes accordion-section-content">
81                                         </ul>
82                                 </div>
83                         </div>
84                 </li>
85 <?php }
86 }