[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/customize/ -> class-wp-customize-themes-panel.php (source)

   1  <?php
   2  /**
   3   * Customize API: WP_Customize_Themes_Panel class
   4   *
   5   * @package WordPress
   6   * @subpackage Customize
   7   * @since 4.9.0
   8   */
   9  
  10  /**
  11   * Customize Themes Panel Class
  12   *
  13   * @since 4.9.0
  14   *
  15   * @see WP_Customize_Panel
  16   */
  17  class WP_Customize_Themes_Panel extends WP_Customize_Panel {
  18  
  19      /**
  20       * Panel type.
  21       *
  22       * @since 4.9.0
  23       * @var string
  24       */
  25      public $type = 'themes';
  26  
  27      /**
  28       * An Underscore (JS) template for rendering this panel's container.
  29       *
  30       * The themes panel renders a custom panel heading with the active theme and a switch themes button.
  31       *
  32       * @see WP_Customize_Panel::print_template()
  33       *
  34       * @since 4.9.0
  35       */
  36  	protected function render_template() {
  37          ?>
  38          <li id="accordion-section-{{ data.id }}" class="accordion-section control-panel-themes">
  39              <h3 class="accordion-section-title">
  40                  <?php
  41                  if ( $this->manager->is_theme_active() ) {
  42                      echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> {{ data.title }}';
  43                  } else {
  44                      echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> {{ data.title }}';
  45                  }
  46                  ?>
  47  
  48                  <?php if ( current_user_can( 'switch_themes' ) ) : ?>
  49                      <button type="button" class="button change-theme" aria-label="<?php esc_attr_e( 'Change theme' ); ?>"><?php _ex( 'Change', 'theme' ); ?></button>
  50                  <?php endif; ?>
  51              </h3>
  52              <ul class="accordion-sub-container control-panel-content"></ul>
  53          </li>
  54          <?php
  55      }
  56  
  57      /**
  58       * An Underscore (JS) template for this panel's content (but not its container).
  59       *
  60       * Class variables for this panel class are available in the `data` JS object;
  61       * export custom variables by overriding WP_Customize_Panel::json().
  62       *
  63       * @since 4.9.0
  64       *
  65       * @see WP_Customize_Panel::print_template()
  66       */
  67  	protected function content_template() {
  68          ?>
  69          <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
  70              <button class="customize-panel-back" tabindex="-1" type="button"><span class="screen-reader-text">
  71                  <?php
  72                  /* translators: Hidden accessibility text. */
  73                  _e( 'Back' );
  74                  ?>
  75              </span></button>
  76              <div class="accordion-section-title">
  77                  <span class="preview-notice">
  78                      <?php
  79                      printf(
  80                          /* translators: %s: Themes panel title in the Customizer. */
  81                          __( 'You are browsing %s' ),
  82                          '<strong class="panel-title">' . __( 'Themes' ) . '</strong>'
  83                      ); // Separate strings for consistency with other panels.
  84                      ?>
  85                  </span>
  86                  <?php if ( current_user_can( 'install_themes' ) && ! is_multisite() ) : ?>
  87                      <# if ( data.description ) { #>
  88                          <button class="customize-help-toggle dashicons dashicons-editor-help" type="button" aria-expanded="false"><span class="screen-reader-text">
  89                              <?php
  90                              /* translators: Hidden accessibility text. */
  91                              _e( 'Help' );
  92                              ?>
  93                          </span></button>
  94                      <# } #>
  95                  <?php endif; ?>
  96              </div>
  97              <?php if ( current_user_can( 'install_themes' ) && ! is_multisite() ) : ?>
  98                  <# if ( data.description ) { #>
  99                      <div class="description customize-panel-description">
 100                          {{{ data.description }}}
 101                      </div>
 102                  <# } #>
 103              <?php endif; ?>
 104  
 105              <div class="customize-control-notifications-container"></div>
 106          </li>
 107          <li class="customize-themes-full-container-container">
 108              <div class="customize-themes-full-container">
 109                  <div class="customize-themes-notifications"></div>
 110              </div>
 111          </li>
 112          <?php
 113      }
 114  }


Generated : Thu Mar 28 08:20:01 2024 Cross-referenced by PHPXref