public function DateRecurDefaultFormatter::settingsForm in Recurring Dates Field 8
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 DateRangeDefaultFormatter::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ DateRecurDefaultFormatter.php, line 54
Class
- DateRecurDefaultFormatter
- Plugin implementation of the 'date_recur_default_formatter' formatter.
Namespace
Drupal\date_recur\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['show_rrule'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show repeat rule'),
'#default_value' => $this
->getSetting('show_rrule'),
];
$form['show_next'] = [
'#type' => 'select',
'#options' => $this
->showNextOptions(),
'#title' => $this
->t('Show next occurrences'),
'#default_value' => $this
->getSetting('show_next'),
];
$form['count_per_item'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Limit occurrences per field item'),
'#default_value' => $this
->getSetting('count_per_item'),
'#description' => $this
->t('If disabled, the number of occurrences shown is limited across all field items.'),
];
$form['occurrence_format_type'] = $form['format_type'];
$form['occurrence_format_type']['#title'] .= ' ' . t('(Occurrences)');
$form['occurrence_format_type']['#default_value'] = $this
->getSetting('occurrence_format_type');
$form['same_end_date_format_type'] = $form['format_type'];
$form['same_end_date_format_type']['#title'] .= ' ' . t('(End date if same day as start date)');
$form['same_end_date_format_type']['#default_value'] = $this
->getSetting('same_end_date_format_type');
return $form;
}