function FieldStorageAddForm::validateAddExisting
Same name in other branches
- 8.9.x core/modules/field_ui/src/Form/FieldStorageAddForm.php \Drupal\field_ui\Form\FieldStorageAddForm::validateAddExisting()
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()
1 call to FieldStorageAddForm::validateAddExisting()
- FieldStorageAddForm::validateForm in core/
modules/ field_ui/ src/ Form/ FieldStorageAddForm.php - Form validation handler.
File
-
core/
modules/ field_ui/ src/ Form/ FieldStorageAddForm.php, line 302
Class
- FieldStorageAddForm
- Provides a form for the "field storage" add page.
Namespace
Drupal\field_ui\FormCode
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.'));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.