function FieldStorageAddForm::validateGroupOrField

Same name and namespace in other branches
  1. 11.x core/modules/field_ui/src/Form/FieldStorageAddForm.php \Drupal\field_ui\Form\FieldStorageAddForm::validateGroupOrField()

Validates the first step of the form.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

core/modules/field_ui/src/Form/FieldStorageAddForm.php, line 412

Class

FieldStorageAddForm
Provides a form for the "field storage" add page.

Namespace

Drupal\field_ui\Form

Code

public function validateGroupOrField(array &$form, FormStateInterface $form_state) {
    if (!$form_state->getValue('new_storage_type')) {
        $form_state->setErrorByName('add', $this->t('You need to select a field type.'));
    }
}

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