[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
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"><?php _e( 'Back' ); ?></span></button> 71 <div class="accordion-section-title"> 72 <span class="preview-notice"> 73 <?php 74 printf( 75 /* translators: %s: Themes panel title in the Customizer. */ 76 __( 'You are browsing %s' ), 77 '<strong class="panel-title">' . __( 'Themes' ) . '</strong>' 78 ); // Separate strings for consistency with other panels. 79 ?> 80 </span> 81 <?php if ( current_user_can( 'install_themes' ) && ! is_multisite() ) : ?> 82 <# if ( data.description ) { #> 83 <button class="customize-help-toggle dashicons dashicons-editor-help" type="button" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> 84 <# } #> 85 <?php endif; ?> 86 </div> 87 <?php if ( current_user_can( 'install_themes' ) && ! is_multisite() ) : ?> 88 <# if ( data.description ) { #> 89 <div class="description customize-panel-description"> 90 {{{ data.description }}} 91 </div> 92 <# } #> 93 <?php endif; ?> 94 95 <div class="customize-control-notifications-container"></div> 96 </li> 97 <li class="customize-themes-full-container-container"> 98 <div class="customize-themes-full-container"> 99 <div class="customize-themes-notifications"></div> 100 </div> 101 </li> 102 <?php 103 } 104 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |