public function __construct($field_id, $field) { // Call parent constructor parent::__construct($field_id, $field); // Checkboxes need a custom wrapper class add_filter('wpas_cf_wrapper_class', array($this, 'wrapper_class'), 10, 2); }
public function __construct($field_id, $field) { /* Call the parent constructor */ parent::__construct($field_id, $field); /* Set the additional parameters */ if (!isset($this->field_args['multiple'])) { $this->field_args['multiple'] = false; } /* Change the field name if multiple upload is enabled */ add_filter('wpas_cf_field_atts', array($this, 'edit_field_atts'), 10, 3); }
public function __construct($field_id, $field) { /* Call the parent constructor */ parent::__construct($field_id, $field); // Set the additional parameters $this->field_args['multiple'] = isset($this->field_args['multiple']) ? (bool) $this->field_args['multiple'] : false; $this->field_args['select2'] = isset($this->field_args['select2']) ? (bool) $this->field_args['select2'] : false; /* Change the field name if multiple upload is enabled */ if (true === $this->field_args['multiple']) { add_filter('wpas_cf_field_atts', array($this, 'edit_field_atts'), 10, 3); } if (true === $this->field_args['select2']) { add_filter('wpas_cf_field_class', array($this, 'add_select2_class'), 10, 2); } }
public function __construct($field_id, $field) { /* Call the parent constructor */ parent::__construct($field_id, $field); $args = func_get_args(); call_user_func_array(array($this, 'parent::__construct'), $args); $this->terms = get_terms($this->field_id, array('hide_empty' => 0)); $this->ordered_terms = array(); if (!is_wp_error($this->terms)) { /** * Re-order the terms hierarchically. */ wpas_sort_terms_hierarchicaly($this->terms, $this->ordered_terms); } }
public function __construct($field_id, $field) { /* Call the parent constructor */ parent::__construct($field_id, $field); $args = func_get_args(); call_user_func_array(array($this, 'parent::__construct'), $args); $this->terms = get_terms($this->field_id, array('hide_empty' => 0)); $this->ordered_terms = array(); $this->field_args['select2'] = isset($this->field_args['select2']) ? (bool) $this->field_args['select2'] : false; if (!is_wp_error($this->terms)) { /** * Re-order the terms hierarchically. */ wpas_sort_terms_hierarchicaly($this->terms, $this->ordered_terms); } if (true === $this->field_args['select2']) { add_filter('wpas_cf_field_class', array($this, 'add_select2_class'), 10, 2); } }