public function SmartDateDatelistWidget::settingsForm in Smart Date 3.2.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 8 src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 3.x src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 3.0.x src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 3.1.x src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 3.3.x src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
- 3.4.x src/Plugin/Field/FieldWidget/SmartDateDatelistWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDatelistWidget::settingsForm()
Returns a form to configure settings for the widget.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form definition for the widget settings.
Overrides SmartDateWidgetBase::settingsForm
File
- src/
Plugin/ Field/ FieldWidget/ SmartDateDatelistWidget.php, line 101
Class
- SmartDateDatelistWidget
- Plugin implementation of the 'smartdate_datelist' widget.
Namespace
Drupal\smart_date\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element['date_order'] = [
'#type' => 'select',
'#title' => $this
->t('Date part order'),
'#default_value' => $this
->getSetting('date_order'),
'#options' => [
'MDY' => $this
->t('Month/Day/Year'),
'DMY' => $this
->t('Day/Month/Year'),
'YMD' => $this
->t('Year/Month/Day'),
],
];
$element['time_type'] = [
'#type' => 'select',
'#title' => $this
->t('Time type'),
'#default_value' => $this
->getSetting('time_type'),
'#options' => [
'24' => $this
->t('24 hour time'),
'12' => $this
->t('12 hour time'),
],
];
$element['increment'] = [
'#type' => 'select',
'#title' => $this
->t('Time increments'),
'#default_value' => $this
->getSetting('increment'),
'#options' => [
1 => $this
->t('1 minute'),
5 => $this
->t('5 minute'),
10 => $this
->t('10 minute'),
15 => $this
->t('15 minute'),
30 => $this
->t('30 minute'),
],
];
return $element;
}