You are here

public function FractionFormatterBase::settingsForm in Fraction 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/FractionFormatterBase.php \Drupal\fraction\Plugin\Field\FieldFormatter\FractionFormatterBase::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

1 call to FractionFormatterBase::settingsForm()
FractionDecimalFormatter::settingsForm in src/Plugin/Field/FieldFormatter/FractionDecimalFormatter.php
Returns a form to configure settings for the formatter.
2 methods override FractionFormatterBase::settingsForm()
FractionDecimalFormatter::settingsForm in src/Plugin/Field/FieldFormatter/FractionDecimalFormatter.php
Returns a form to configure settings for the formatter.
FractionFormatter::settingsForm in src/Plugin/Field/FieldFormatter/FractionFormatter.php
Returns a form to configure settings for the formatter.

File

src/Plugin/Field/FieldFormatter/FractionFormatterBase.php, line 28

Class

FractionFormatterBase
Base class for fraction formatters.

Namespace

Drupal\fraction\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements = parent::settingsForm($form, $form_state);
  $elements['prefix_suffix'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display prefix and suffix'),
    '#default_value' => $this
      ->getSetting('prefix_suffix'),
    '#weight' => 10,
  ];
  return $elements;
}