function DecimalFormatter::settingsForm
Overrides NumericFormatterBase::settingsForm
File
- 
              core/lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ DecimalFormatter.php, line 40 
Class
- DecimalFormatter
- Plugin implementation of the 'number_decimal' formatter.
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements = parent::settingsForm($form, $form_state);
  $elements['decimal_separator'] = [
    '#type' => 'select',
    '#title' => $this->t('Decimal marker'),
    '#options' => [
      '.' => $this->t('Decimal point'),
      ',' => $this->t('Comma'),
    ],
    '#default_value' => $this->getSetting('decimal_separator'),
    '#weight' => 5,
  ];
  $elements['scale'] = [
    '#type' => 'number',
    '#title' => $this->t('Scale', [], [
      'context' => 'decimal places',
    ]),
    '#min' => 0,
    '#max' => 10,
    '#default_value' => $this->getSetting('scale'),
    '#description' => $this->t('The number of digits to the right of the decimal.'),
    '#weight' => 6,
  ];
  return $elements;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
