<?php
/**
 * Text message custom control.
 *
 * @since  1.0.0
 * @access public
 */

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

if ( ! class_exists( 'Travel_Tour_Text_Message_Control' ) ) {

    class Travel_Tour_Text_Message_Control extends WP_Customize_Control {

        /**
         * Section type.
         *
         * @var string
         */
        public $type = 'text_message';

        /**
         * Title
         *
         * @var string
         */
        public $title = '';

        /**
         * Description
         *
         * @var string
         */
        public $description = '';

        /**
         * Pass parameters to the JS part of the Customizer.
         */
        public function to_json() {
            parent::to_json();

            $this->json['title'] = $this->title;
            $this->json['description'] = wp_kses_post( $this->description );
        }

        protected function content_template() { ?>
            <div style="margin-top: 20px; margin-bottom: 20px;">
                <# if ( data.title ) { #>
                <div class="customize-control-title">{{{ data.title }}}</div>
                <# } #>
                <# if ( data.description ) { #>
                <div class="description customize-control-description">{{{ data.description }}}</div>
                <# } #>
            </div>
        <?php }
    }
}