public function TextfieldWidget::settingsForm

Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().

Overrides WidgetBase::settingsForm

File

drupal/core/modules/text/lib/Drupal/text/Plugin/field/widget/TextfieldWidget.php, line 35
Definition of Drupal\text\Plugin\field\widget\TextfieldWidget.

Class

TextfieldWidget
Plugin implementation of the 'text_textfield' widget.

Namespace

Drupal\text\Plugin\field\widget

Code

public function settingsForm(array $form, array &$form_state) {
  $element['size'] = array(
    '#type' => 'number',
    '#title' => t('Size of textfield'),
    '#default_value' => $this
      ->getSetting('size'),
    '#required' => TRUE,
    '#min' => 1,
  );
  $element['placeholder'] = array(
    '#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;
}