You are here

public function KeyValueFieldTypeTrait::storageSettingsForm in Key value field 8

File

src/Plugin/Field/FieldType/KeyValueFieldTypeTrait.php, line 74

Class

KeyValueFieldTypeTrait
Common traits for key value field types which inherit different field types.

Namespace

Drupal\key_value_field\Plugin\Field\FieldType

Code

public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {

  // Add the key length form element.
  return [
    // Add a form element for the max length of the key element.
    'key_max_length' => [
      '#type' => 'number',
      '#title' => t('Key maximum length'),
      '#default_value' => $this
        ->getSetting('key_max_length'),
      '#required' => TRUE,
      '#description' => t('The maximum length of the "key" field in characters.'),
      '#min' => 1,
      '#disabled' => $has_data,
    ],
  ] + parent::storageSettingsForm($form, $form_state, $has_data);
}