public function FieldTimerCountyFormatter::settingsForm in Field Timer 2.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/FieldTimerCountyFormatter.php \Drupal\field_timer\Plugin\Field\FieldFormatter\FieldTimerCountyFormatter::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 FormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ FieldTimerCountyFormatter.php, line 96
Class
- FieldTimerCountyFormatter
- Plugin implementation of the 'field_timer_county' formatter.
Namespace
Drupal\field_timer\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['animation'] = [
'#type' => 'select',
'#title' => $this
->t('Animation'),
'#options' => $this
->animationOptions(),
'#default_value' => $this
->getSetting('animation'),
];
$form['speed'] = [
'#type' => 'textfield',
'#title' => $this
->t('Speed'),
'#default_value' => $this
->getSetting('speed'),
];
$form['theme'] = [
'#type' => 'select',
'#title' => $this
->t('Theme'),
'#options' => $this
->themeOptions(),
'#default_value' => $this
->getSetting('theme'),
];
$form['background'] = [
'#type' => 'textfield',
'#title' => $this
->t('Background'),
'#default_value' => $this
->getSetting('background'),
'#description' => $this
->t('Data from this field will be added to css property \'background\'.'),
];
$form['reflection'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Add reflection'),
'#default_value' => $this
->getSetting('reflection'),
'#attributes' => [
'class' => [
'field-timer-county-reflection',
],
],
];
$form['reflectionOpacity'] = [
'#type' => 'textfield',
'#title' => $this
->t('Reflection opacity'),
'#default_value' => $this
->getSetting('reflectionOpacity'),
'#description' => $this
->t('Float value between 0 and 1.'),
'#states' => [
'invisible' => [
'input.field-timer-county-reflection' => [
'checked' => FALSE,
],
],
],
];
return $form;
}