FieldStorageAddForm::validateAddExisting

protected FieldStorageAddForm::validateAddExisting(array $form, FormStateInterface $form_state)

Validates the 're-use existing field' case.

Parameters

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

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

See also

\Drupal\field_ui\Form\FieldStorageAddForm::validateForm()

File

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

Class

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

Namespace

Drupal\field_ui\Form

Code

protected function validateAddExisting(array $form, FormStateInterface $form_state) {
  if ($form_state->getValue('existing_storage_name')) {
    // Missing label.
    if (!$form_state->getValue('existing_storage_label')) {
      $form_state->setErrorByName('existing_storage_label', $this->t('Re-use existing field: you need to provide a label.'));
    }
  }
}
doc_Drupal
2016-10-29 09:12:09
Comments
Leave a Comment

Please login to continue.