function StringItem::storageSettingsForm

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

Overrides FieldItemBase::storageSettingsForm

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php, line 128

Class

StringItem
Defines the 'string' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
    $element = [];
    $element['max_length'] = [
        '#type' => 'number',
        '#title' => $this->t('Maximum length'),
        '#default_value' => $this->getSetting('max_length'),
        '#required' => TRUE,
        '#description' => $this->t('The maximum length of the field in characters.'),
        '#min' => 1,
        '#disabled' => $has_data,
    ];
    return $element;
}

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