<?php class ReduxFramework_select 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 1.0.0
	*/
	function __construct($field = array(), $value ='', $parent){
		
		parent::__construct($parent->sections, $parent-&gt;args, $parent-&gt;extra_tabs);&#13;
		$this-&gt;field = $field;&#13;
		$this-&gt;value = $value;&#13;
		//$this-&gt;render();&#13;
&#13;
		&#13;
        if( !empty( $this-&gt;field['data'] ) &amp;&amp; empty( $this-&gt;field['options'] ) ) {&#13;
			if (empty($this-&gt;field['args'])) {&#13;
				$this-&gt;field['args'] = array();&#13;
			}&#13;
			if ($this-&gt;field['data'] == "elusive-icons" || $this-&gt;field['data'] == "elusive-icon" || $this-&gt;field['data'] == "elusive" ) {&#13;
       			$icons_file = ReduxFramework::$_dir.'inc/fields/select/fontawesome-icons.php';&#13;
       			$icons_file = apply_filters('redux-font-icons-file',$icons_file);&#13;
       			if(file_exists($icons_file))&#13;
       				require_once $icons_file;&#13;
			}        	&#13;
        	$this-&gt;field['options'] = $parent-&gt;get_wordpress_data($this-&gt;field['data'], $this-&gt;field['args']);&#13;
        }&#13;
&#13;
	}//function&#13;
	&#13;
&#13;
&#13;
	/**&#13;
	 * Field Render Function.&#13;
	 *&#13;
	 * Takes the vars and outputs the HTML for the field in the settings&#13;
	 *&#13;
	 * @since ReduxFramework 1.0.0&#13;
	*/&#13;
	function render(){&#13;
&#13;
		if ( !empty($this-&gt;field['data']) &amp;&amp; ( $this-&gt;field['data'] == "elusive-icons" || $this-&gt;field['data'] == "elusive-icon" || $this-&gt;field['data'] == "elusive" ) ) {&#13;
       		$this-&gt;field['class'] = " font-icons";&#13;
		}//if&#13;
&#13;
		if (!empty($this-&gt;field['options'])) {&#13;
			if (isset($this-&gt;field['multi']) &amp;&amp; $this-&gt;field['multi']) {&#13;
				$multi = ' multiple="multiple"';&#13;
			} else {&#13;
				$multi = "";&#13;
			}&#13;
			&#13;
			if (!empty($this-&gt;field['width'])) {&#13;
				$width = ' style="'.$this-&gt;field['width'].'"';&#13;
			} else {&#13;
				$width = ' style="width: 40%;"';&#13;
			}	&#13;
&#13;
			$nameBrackets = "";&#13;
			if (!empty($multi)) {&#13;
				$nameBrackets = "[]";&#13;
			}&#13;
&#13;
			$placeholder = (isset($this-&gt;field['placeholder'])) ? esc_attr($this-&gt;field['placeholder']) : __( 'Select an item', 'redux-framework' );&#13;
&#13;
			if ( isset($this-&gt;field['select2']) ) { // if there are any let's pass them to js&#13;
				$select2_params = json_encode($this-&gt;field['select2']);&#13;
				$select2_params = htmlspecialchars( $select2_params , ENT_QUOTES);&#13;
				echo '<input type="hidden" class="select2_params" value="'. $select2_params .'">';&#13;
			}&#13;
&#13;
			echo '<select id="'.$this-&gt;field['id'].'-select" data-placeholder="'.$placeholder.'" name="'.$this-&gt;args['opt_name'].'['.$this-&gt;field['id'].']'.$nameBrackets.'" class="redux-select-item '.$this-&gt;field['class'].'" rows="6">';&#13;
				echo '<option></option>';&#13;
				foreach($this-&gt;field['options'] as $k =&gt; $v){&#13;
					if (is_array($this-&gt;value)) {&#13;
						$selected = (is_array($this-&gt;value) &amp;&amp; in_array($k, $this-&gt;value))?' selected="selected"':'';					&#13;
					} else {&#13;
						$selected = selected($this-&gt;value, $k, false);&#13;
					}&#13;
					echo '<option value="'.$k.'">'.$v.'</option>';&#13;
				}//foreach&#13;
			echo '</select>';			&#13;
		} else {&#13;
			echo '<strong>'.__('No items of this type were found.', 'redux-framework').'</strong>';&#13;
		}&#13;
&#13;
	}//function&#13;
&#13;
	&#13;
	/**&#13;
	 * Enqueue Function.&#13;
	 *&#13;
	 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css&#13;
	 *&#13;
	 * @since ReduxFramework 1.0.0&#13;
	*/&#13;
	function enqueue(){&#13;
		&#13;
		wp_enqueue_script( 'select2-js' );&#13;
		wp_enqueue_style( 'select2-css' );&#13;
&#13;
		wp_enqueue_script(&#13;
			'field-select-js', &#13;
			ReduxFramework::$_url.'inc/fields/select/field_select.min.js',&#13;
			array('jquery', 'select2-js'),&#13;
			time(),&#13;
			true&#13;
		);		&#13;
&#13;
	}//function&#13;
&#13;
}//class