/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'number'); $this->_data['max'] = $this->_max; $this->_data['min'] = $this->_min; $this->_data['step'] = $this->_step; $this->_data['placeholder'] = $this->_placeholder; }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'queryfilter'); $this->_data['taxonomies'] = array(); $this->_data['hide_num'] = false; $this->_data['labels'] = array('num' => __('Number of items to show', 'thb_text_domain'), 'filter' => __('Filter by taxonomy', 'thb_text_domain'), 'include_subcategories' => __('Include subcategories', 'thb_text_domain'), 'orderby' => __('Order by', 'thb_text_domain')); $this->_data['orderby_options'] = array('date' => __('Date', 'thb_text_domain'), 'title' => __('Alphabetically', 'thb_text_domain'), 'rand' => __('Random', 'thb_text_domain')); $this->_data['order_options'] = array('desc' => __('Descending', 'thb_text_domain'), 'asc' => __('Ascending', 'thb_text_domain')); }
/** * Pre-render the field. * * @return void */ protected function preRender() { $options = array(); if ($this->dynamicOptions) { if (is_array($this->dynamicOptions)) { foreach (array_keys($this->dynamicOptions) as $key) { if (is_callable($this->dynamicOptions[$key])) { $options[$key] = call_user_func($this->dynamicOptions[$key]); } } } else { if (is_callable($this->dynamicOptions)) { $options = call_user_func($this->dynamicOptions); } } } foreach ((array) $options as $value => $label) { $this->addOption($value, $label); } parent::preRender(); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'date'); $this->_data['format'] = $this->_format; }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'keyvalue'); }
function thb_duplicable_fields_save(THB_Field $field, $post_id = 0) { $fieldKey = $field->getName(); $uniqids = array(); thb_duplicable_remove($fieldKey, $post_id); $count = 0; if (isset($_POST[$fieldKey])) { if ($field->isComplex()) { $subKeys = $field->getSubkeys(); $count = count($_POST[$fieldKey][$subKeys[0]]); } else { $count = count($_POST[$fieldKey]); } } if ($count > 0) { for ($i = 0; $i < $count; $i++) { if ($field->isComplex()) { $value = array(); foreach ($field->getSubkeys() as $subKey) { if (isset($_POST[$fieldKey][$subKey][$i])) { $value[$subKey] = thb_text_toDB($_POST[$fieldKey][$subKey][$i]); } } // $value = serialize($value); } else { if (isset($_POST[$fieldKey][$i])) { $value = thb_text_toDB($_POST[$fieldKey][$i]); } } $meta['subtemplate'] = $_POST['subtemplate'][$fieldKey][$i]; if (!empty($_POST['uniqid'][$fieldKey][$i])) { $meta['uniqid'] = $_POST['uniqid'][$fieldKey][$i]; } else { $meta['uniqid'] = md5(time() . $i); } $uniqids[] = $meta['uniqid']; if (is_array($value)) { foreach ($value as $k => $v) { $value[$k] = thb_text_normalize($v); } } else { $value = thb_text_normalize($value); } thb_duplicable_add($fieldKey, array('ord' => $i, 'value' => $value, 'meta' => $meta, 'post_id' => $post_id)); } } return $uniqids; }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, THB_TEMPLATE_DIR . '/config/home_page/home-page-slide-field'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'textarea'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'text'); $this->_data['placeholder'] = $this->_placeholder; }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'slide'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'color'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'font'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'checkbox'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'gallery'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, thb_get_module_path('core/contact') . '/templates/contact-info-field'); }
/** * Constructor * * @param string $name The field name. **/ public function __construct($name) { parent::__construct($name, 'classicupload'); }
/** * Pre-render the field. * * @return void */ protected function preRender() { $options = array(); if ($this->dynamicOptions) { if (is_array($this->dynamicOptions)) { foreach (array_keys($this->dynamicOptions) as $key) { if (is_callable($this->dynamicOptions[$key])) { $options[$key] = call_user_func($this->dynamicOptions[$key]); } } } else { if (is_callable($this->dynamicOptions)) { $options = call_user_func($this->dynamicOptions); } } } $depth = thb_array_depth($options); if ($depth == 2) { foreach ((array) $options as $optgroup => $values) { $this->addOptionsGroup($optgroup, $values); } } else { foreach ((array) $options as $value => $label) { $this->addOption($value, $label); } } if ($this->invisibleIfEmpty && count($this->_data['field_options']) <= 1) { $this->addClass('invisible'); } parent::preRender(); }