You are here

public function ElementListClassTrait::settingsForm in Element Class Formatter 8

File

src/Plugin/Field/FieldFormatter/ElementListClassTrait.php, line 33

Class

ElementListClassTrait
The ElementListClassTrait is used to turn multi-cardinality fields into lists with a class.

Namespace

Drupal\element_class_formatter\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements = parent::settingsForm($form, $form_state);
  $class = $this
    ->getSetting('class');
  $elements['list_type'] = [
    '#title' => $this
      ->t('List type'),
    '#type' => 'select',
    '#options' => [
      'ul' => 'Un-ordered list',
      'ol' => 'Ordered list',
    ],
    '#default_value' => $this
      ->getSetting('list_type'),
  ];
  return $this
    ->elementClassSettingsForm($elements, $class);
}