public function MenuReferenceFormatter::settingsForm in Menu Reference Render (Formatter) 8.2
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/ MenuReferenceFormatter.php, line 74
Class
- MenuReferenceFormatter
- Plugin implementation of the 'menu_reference_render' formatter.
Namespace
Drupal\menu_reference_render\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['expand_all_items'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Expand all menu items'),
'#default_value' => $this
->getSetting('expand_all_items'),
'#description' => $this
->t('Override the option found on each menu link used for expanding children and instead display the whole menu tree as expanded.'),
];
return $form;
}