class-kirki-sections-default-section.php (2372B)
1 <?php 2 /** 3 * The default section. 4 * 5 * @package Kirki 6 * @subpackage Controls 7 * @copyright Copyright (c) 2016, Aristeides Stathopoulos 8 * @license http://opensource.org/licenses/https://opensource.org/licenses/MIT 9 * @since 2.2.0 10 */ 11 12 if ( ! class_exists( 'Kirki_Sections_Default_Section' ) ) { 13 14 /** 15 * Default Section. 16 */ 17 class Kirki_Sections_Default_Section extends WP_Customize_Section { 18 19 /** 20 * The section type. 21 * 22 * @access public 23 * @var string 24 */ 25 public $type = 'kirki-default'; 26 27 /** 28 * Gather the parameters passed to client JavaScript via JSON. 29 * 30 * @since 2.3.3 31 * 32 * @return array The array to be exported to the client as JSON. 33 */ 34 public function json() { 35 $array = parent::json(); 36 $array['description'] = html_entity_decode( $array['description'], ENT_QUOTES, get_bloginfo( 'charset' ) ); 37 return $array; 38 } 39 40 /** 41 * An Underscore (JS) template for rendering this section. 42 * 43 * Class variables for this section class are available in the `data` JS object; 44 * export custom variables by overriding WP_Customize_Section::json(). 45 * 46 * @access protected 47 */ 48 protected function render_template() { 49 $l10n = Kirki_l10n::get_strings(); 50 ?> 51 <li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }}"> 52 <h3 class="accordion-section-title" tabindex="0"> 53 {{{ data.title }}} 54 <span class="screen-reader-text">{{ window.kirki.l10n.global['open-section'] }}</span> 55 </h3> 56 <ul class="accordion-section-content"> 57 <li class="customize-section-description-container"> 58 <div class="customize-section-title"> 59 <button class="customize-section-back" tabindex="-1"> 60 <span class="screen-reader-text">{{ window.kirki.l10n.global.back }}</span> 61 </button> 62 <h3> 63 <span class="customize-action"> 64 {{{ data.customizeAction }}} 65 </span> 66 {{{ data.title }}} 67 <a href="#" class="kirki-reset-section" data-reset-section-id="{{ data.id }}"> 68 {{{ window.kirki.l10n.global['reset-with-icon'] }}} 69 </a> 70 </h3> 71 </div> 72 <# if ( data.description ) { #> 73 <div class="description customize-section-description"> 74 {{{ data.description }}} 75 </div> 76 <# } #> 77 </li> 78 </ul> 79 </li> 80 <?php 81 } 82 } 83 }