<?php class ReduxFramework_switch extends ReduxFramework{	
	
	/**
	 * Field Constructor.
	 *
	 * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
	 *
	 * @since ReduxFramework 0.0.4
	*/
	function __construct($field = array(), $value ='', $parent){
		
		parent::__construct($parent->sections, $parent-&gt;args, $parent-&gt;extra_tabs);
		$this-&gt;field = $field;
		$this-&gt;value = $value;
		//$this-&gt;render();
		
	}//function
	


	/**
	 * Field Render Function.
	 *
	 * Takes the vars and outputs the HTML for the field in the settings
	 *
	 * @since ReduxFramework 0.0.4
	*/
	function render(){
		
		$cb_enabled = $cb_disabled = '';//no errors, please

		//Get selected
		if ( (int) $this-&gt;value == 1 ){
			$cb_enabled = ' selected';
		}else {
			$cb_disabled = ' selected';
		}
		
		//Label ON
		if(!isset($this-&gt;field['on'])){
			$on = "On";
		}else{
			$on = $this-&gt;field['on'];
		}
		
		//Label OFF
		if(!isset($this-&gt;field['off'])){
			$off = "Off";
		} else{
			$off = $this-&gt;field['off'];
		}

		echo '<div class="switch-options">';
			echo '<label class="cb-enable'. $cb_enabled .'" data-id="'.$this-&gt;field['id'].'"><span>'. $on .'</span></label>';
			echo '<label class="cb-disable'. $cb_disabled .'" data-id="'.$this-&gt;field['id'].'"><span>'. $off .'</span></label>';
			echo '<input type="hidden" class="checkbox checkbox-input'.$this-&gt;field['class'].'" id="'.$this-&gt;field['id'].'" name="'.$this-&gt;args['opt_name'].'['.$this-&gt;field['id'].']" value="'.$this-&gt;value.'">';
		echo '</div>';

	}//function
	
	/**
	 * Enqueue Function.
	 *
	 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
	 *
	 * @since ReduxFramework 0.0.4
	*/
	function enqueue(){
		
		wp_enqueue_script(
			'redux-field-switch-js', 
			ReduxFramework::$_url.'inc/fields/switch/field_switch.min.js', 
			array('jquery'),
			time(),
			true
		);		

		wp_enqueue_style(
			'redux-field-switch-css', 
			ReduxFramework::$_url.'inc/fields/switch/field_switch.css', 
			time(),
			true
		);		

	}//function

}//class