<?php
/**
 * Customizer Header Toggle Control.
 * 
 * @package Purenote
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

if ( ! class_exists( 'Purenote_Control_Heading_Toggle' ) ) :
    
    /**
     * Heading control.
     *
     * @since 1.0.0
     */
    class Purenote_Control_Heading_Toggle extends WP_Customize_Control {

        /**
         * The control type.
         *
         * @access public
         * @var string
         * @since 1.0.0
         */
        public $type = 'mt-heading-toggle';

        /**
         * Add initial stage of toggle.
         *
         * @access public
         * @var boolean
         * @since 1.0.0
         */
        public $initial = true;

        /**
         * Add custom JSON parameters to use in the JS template.
         *
         * @since  1.0.0
         * @access public
         * @return void
         */
        public function to_json() {
            parent::to_json();
            $this->json['initial'] = $this->initial;
        }

        /**
         *
         * @see WP_Customize_Control::print_template()
         *
         * @access protected
         */
        protected function content_template() {
    ?>
        <div class="mt-customize-heading-toggle">
            <h4 class="mt-customizer-heading-toggle">{{{ data.label }}}</h4>
             <span class="toggle-button"><span class="dashicons dashicons-arrow-up-alt2"></span></span>
            <# if ( data.description ) { #>
            <div class="description">{{{ data.description }}}</div>
            <# } #>
        </div>
    <?php
        }

    }

endif;