/** * Generate HTML for the form element itself. Generally should be just one tag, no wrappers. * * @param mixed string[]|string the value of the element. * @return string HTML for the element. */ public function form_element($value) { $value = absint($value); $old_value = $value; // If we're storing the local time, in order to make the form work as expected, we have // to alter the timestamp. This isn't ideal, but there currently isn't a good way around // it in WordPress. if ($this->store_local_time) { $value += get_option('gmt_offset') * HOUR_IN_SECONDS; } ob_start(); include fieldmanager_get_template('datepicker'); // Reset the timestamp $value = $old_value; return ob_get_clean(); }
/** * @param mixed string[]|string the value of the element. * @return string HTML for the element. * Generate HTML for the form element itself. Generally should be just one tag, no wrappers. */ public function form_element($value) { if (!$this->template) { $tpl_slug = strtolower(str_replace('Fieldmanager_', '', get_class($this))); $this->template = fieldmanager_get_template($tpl_slug); } ob_start(); include $this->template; return ob_get_clean(); }
/** * Construct default attributes, set link sanitizer * @param string $label * @param array $options */ public function __construct($label = '', $options = array()) { $this->sanitize = 'esc_url_raw'; $this->template = fieldmanager_get_template('textfield'); parent::__construct($label, $options); }