function NumericFormatterBase::settingsForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase::settingsForm()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase::settingsForm()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase::settingsForm()

Overrides FormatterBase::settingsForm

1 call to NumericFormatterBase::settingsForm()
DecimalFormatter::settingsForm in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
Returns a form to configure settings for the formatter.
1 method overrides NumericFormatterBase::settingsForm()
DecimalFormatter::settingsForm in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
Returns a form to configure settings for the formatter.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php, line 17

Class

NumericFormatterBase
Parent plugin for decimal and integer formatters.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $options = [
        '' => $this->t('- None -'),
        '.' => $this->t('Decimal point'),
        ',' => $this->t('Comma'),
        ' ' => $this->t('Space'),
        chr(8201) => $this->t('Thin space'),
        "'" => $this->t('Apostrophe'),
    ];
    $elements['thousand_separator'] = [
        '#type' => 'select',
        '#title' => $this->t('Thousand marker'),
        '#options' => $options,
        '#default_value' => $this->getSetting('thousand_separator'),
        '#weight' => 0,
    ];
    $elements['prefix_suffix'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Display prefix and suffix'),
        '#default_value' => $this->getSetting('prefix_suffix'),
        '#weight' => 10,
    ];
    return $elements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.