public function FieldTimerCountdownLedFormatter::settingsForm in Field Timer 2.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/FieldTImerCountdownLedFormatter.php \Drupal\field_timer\Plugin\Field\FieldFormatter\FieldTimerCountdownLedFormatter::settingsForm()
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. 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 elements for the formatter settings.
Overrides FieldTimerCountdownFormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ FieldTImerCountdownLedFormatter.php, line 81
Class
- FieldTimerCountdownLedFormatter
- Plugin implementation of the 'field_timer_countdown' formatter.
Namespace
Drupal\field_timer\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['countdown_theme'] = [
'#type' => 'select',
'#title' => $this
->t('Theme'),
'#options' => $this
->themeOptions(),
'#default_value' => $this
->getSetting('countdown_theme'),
];
$form['display_days'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display days'),
'#default_value' => $this
->getSetting('display_days'),
'#attributes' => [
'class' => [
'field-timer-display-days',
],
],
];
$form['max_count_of_days'] = [
'#type' => 'select',
'#title' => $this
->t('Max count of days'),
'#options' => $this
->dayOptions(),
'#default_value' => $this
->getSetting('max_count_of_days'),
'#states' => [
'invisible' => [
'input.field-timer-display-days' => [
'checked' => FALSE,
],
],
],
];
$form['display_hours'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display hours'),
'#default_value' => $this
->getSetting('display_hours'),
];
$form['display_minutes'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display minutes'),
'#default_value' => $this
->getSetting('display_minutes'),
];
$form['display_seconds'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display seconds'),
'#default_value' => $this
->getSetting('display_seconds'),
];
return $form;
}