You are here

public function CshsFormatterBase::settingsForm in Client-side Hierarchical Select 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/CshsFormatterBase.php \Drupal\cshs\Plugin\Field\FieldFormatter\CshsFormatterBase::settingsForm()
  2. 8.2 src/Plugin/Field/FieldFormatter/CshsFormatterBase.php \Drupal\cshs\Plugin\Field\FieldFormatter\CshsFormatterBase::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

2 calls to CshsFormatterBase::settingsForm()
CshsFlexibleHierarchyFormatter::settingsForm in src/Plugin/Field/FieldFormatter/CshsFlexibleHierarchyFormatter.php
Returns a form to configure settings for the formatter.
CshsFullHierarchyFormatter::settingsForm in src/Plugin/Field/FieldFormatter/CshsFullHierarchyFormatter.php
Returns a form to configure settings for the formatter.
2 methods override CshsFormatterBase::settingsForm()
CshsFlexibleHierarchyFormatter::settingsForm in src/Plugin/Field/FieldFormatter/CshsFlexibleHierarchyFormatter.php
Returns a form to configure settings for the formatter.
CshsFullHierarchyFormatter::settingsForm in src/Plugin/Field/FieldFormatter/CshsFullHierarchyFormatter.php
Returns a form to configure settings for the formatter.

File

src/Plugin/Field/FieldFormatter/CshsFormatterBase.php, line 32

Class

CshsFormatterBase
Base formatter for CSHS field.

Namespace

Drupal\cshs\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) : array {
  $element = [];
  $element['linked'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Link to term page'),
    '#default_value' => $this
      ->getSetting('linked'),
  ];
  $element['reverse'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Reverse order view'),
    '#default_value' => $this
      ->getSetting('reverse'),
    '#description' => $this
      ->t('Outputs hierarchy in reverse order (the deepest level first).'),
  ];
  return $element;
}