<?php
/**
 * Customizer Heading Control.
 * 
 * Adds a custom control to the WordPress Customizer for displaying headings or titles.
 * 
 * @package Yaatra
 */

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

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

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

        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="cv-customize-heading-toggle">
            <h4 class="cv-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;