public function TimeField::fieldSettingsForm in Timefield 1.0.x
Returns a form for the field-level settings.
Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.
Return value
array The form definition for the field settings.
Overrides FieldItemBase::fieldSettingsForm
File
- src/
Plugin/ Field/ FieldType/ TimeField.php, line 38
Class
- TimeField
- Plugin implementation of the 'timefield' field type.
Namespace
Drupal\timefield\Plugin\Field\FieldTypeCode
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$element = [];
$element['totime'] = [
'#title' => $this
->t('To Time'),
'#type' => 'select',
'#options' => [
'' => $this
->t('Never'),
'optional' => $this
->t('Optional'),
'required' => $this
->t('Required'),
],
'#description' => $this
->t('Whether this field should include an end time.'),
'#default_value' => $this
->getSetting('totime'),
];
$element['weekly_summary'] = [
'#title' => $this
->t('Add Weekly Repeat Checkboxes'),
'#type' => 'checkbox',
'#description' => $this
->t('Should this field include options to specify the days on which it repeats.'),
'#default_value' => $this
->getSetting('weekly_summary'),
];
$element['weekly_summary_with_label'] = [
'#title' => $this
->t('Add Weekly Repeat Checkboxes with Label for each Time'),
'#type' => 'checkbox',
'#description' => $this
->t('Same as above with an additional label field for describing times.'),
'#default_value' => $this
->getSetting('weekly_summary_with_label'),
];
return $element;
}