You are here

public function ListBase::settingsForm in Double Field 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/ListBase.php \Drupal\double_field\Plugin\Field\FieldFormatter\ListBase::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 Base::settingsForm

1 call to ListBase::settingsForm()
HtmlList::settingsForm in src/Plugin/Field/FieldFormatter/HtmlList.php
Returns a form to configure settings for the formatter.
1 method overrides ListBase::settingsForm()
HtmlList::settingsForm in src/Plugin/Field/FieldFormatter/HtmlList.php
Returns a form to configure settings for the formatter.

File

src/Plugin/Field/FieldFormatter/ListBase.php, line 22

Class

ListBase
Base class for list formatters.

Namespace

Drupal\double_field\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) : array {
  $element = parent::settingsForm($form, $form_state);
  $settings = $this
    ->getSettings();
  $element['inline'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display as inline element'),
    '#default_value' => $settings['inline'],
    '#weight' => -10,
  ];
  return $element;
}