<?php
/**
 * Frontpage Customizer Settings
 *
 * @package Open News
 *
 * Custom Controller
 */

/**
 * Toggle Switch Custom Control
 *
 * @author Anthony Hortin <http://maddisondesigns.com>
 * @license http://www.gnu.org/licenses/gpl-2.0.html
 * @link https://github.com/maddisondesigns
 */
class Open_News_Toggle_Checkbox_Custom_control extends WP_Customize_Control {
	/**
	 * The type of control being rendered
	 */
	public $type = 'toggle_switch';

	/**
	 * Render the control in the customizer
	 */
	public function render_content(){
		?>
		<div class="toggle-switch-control">
			<div class="toggle-switch">
				<input type="checkbox" id="<?php echo esc_attr($this->id); ?>" name="<?php echo esc_attr($this->id); ?>" class="toggle-switch-checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?>>
				<label class="toggle-switch-label" for="<?php echo esc_attr( $this->id ); ?>">
					<span class="toggle-switch-inner"></span>
					<span class="toggle-switch-switch"></span>
				</label>
			</div>
			<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
			<?php if( ! empty( $this->description ) ) { ?>
				<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
			<?php } ?>
		</div>
		<?php
	}
}

class Open_News_Section_Sub_Heading_Control extends WP_Customize_Control {

	// The type of control being rendered.
	public $type = 'sub_section_heading';

	// Render the control in the customizer.

	public function render_content() {

		?>
		<div class="sub-section-heading-control">
			<?php if ( ! empty( $this->label ) ) { ?>
				<h4 class="customize-control-title">
					<?php echo esc_html( $this->label ); ?>
				</h4>
			<?php } ?>

		</div>
		<?php
	}
}
