dtp = new acf_field_date_time_picker_common(); $this->name = $this->dtp->name; $this->label = $this->dtp->label; $this->category = $this->dtp->category; $this->defaults = $this->dtp->defaults; add_action('init', array($this, 'init')); parent::__construct(); } /** * Initialize translations * * @since 1.0.0 */ public function init() { $this->l10n = $this->dtp->translations(); } /** * Create extra settings for the field * * @since 1.0.0 * * @param array $field The field being edited */ public function render_field_settings($field) { acf_render_field_setting($field, array( 'label' => __('Field type', 'acf-date-time-picker'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'field_type', 'choices' => array('date_time' => __('date & time', 'acf-date-time-picker'), 'time' => __('time only', 'acf-date-time-picker')), )); acf_render_field_setting($field, array( 'label' => __('Date format', 'acf-date-time-picker'), 'instructions' => __('Read more about date formats', 'acf-date-time-picker'), 'type' => 'text', 'name' => 'date_format', )); acf_render_field_setting($field, array( 'label' => __('Time format', 'acf-date-time-picker'), 'instructions' => __('Read more about time formats', 'acf-date-time-picker'), 'type' => 'text', 'name' => 'time_format', )); acf_render_field_setting($field, array( 'label' => __('Allow past dates?', 'acf-date-time-picker'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'past_dates', 'choices' => array('yes' => __('yes', 'acf-date-time-picker'), 'no' => __('no', 'acf-date-time-picker')), )); acf_render_field_setting($field, array( 'label' => __('Timepicker type', 'acf-date-time-picker'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'time_selector', 'choices' => array('slider' => __('slider', 'acf-date-time-picker'), 'select' => __('dropdown list', 'acf-date-time-picker')), )); global $wp_locale; $choices = array_values($wp_locale->weekday); acf_render_field_setting($field, array( 'label' => __('Week starts on', 'acf-date-time-picker'), 'type' => 'select', 'name' => 'first_day', 'choices' => $choices, )); } /** * Create the HTML interface for the field * * @since 1.0.0 * * @param array $field The field being rendered */ public function render_field($field) { ?>