function NumberWidget::settingsForm

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

Overrides WidgetBase::settingsForm

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php, line 38

Class

NumberWidget
Plugin implementation of the 'number' widget.

Namespace

Drupal\Core\Field\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $element['placeholder'] = [
        '#type' => 'textfield',
        '#title' => t('Placeholder'),
        '#default_value' => $this->getSetting('placeholder'),
        '#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
    ];
    return $element;
}

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