type = 'Chosen_Select'; $this->defaults = array( 'multiple' => 1, 'allow_null' => 0, 'choices' => array(), 'default_value' => array(), 'class' => '', 'ajax' => false, 'rule_type' => '', ); } public function render( $field, $value = null ) { $field = array_merge( $this->defaults, $field ); $current = $value ? $value : array(); $choices = $field['choices']; $chosen_class = 'bwfan_select2 '; $data_attr = ''; $multiple = $field['multiple'] ? 'multiple' : ''; if ( true === $field['ajax'] ) { $chosen_class = 'bwfan_select2_ajax '; $data_attr = 'data-search-type="' . $field['search_type'] . '"'; } if ( ! empty( $field['rule_type'] ) ) { $data_attr .= ' data-rule-type="' . $field['rule_type'] . '"'; } ?>