public function AddForm::validateForm in Custom Meta 2.0.x
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ AddForm.php, line 84
Class
- AddForm
- Provides the custom meta tag add form.
Namespace
Drupal\custom_meta\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if (!$form_state
->getValue('id') && array_key_exists($form_state
->getValue('name'), $this
->config('custom_meta.settings')
->get('tag'))) {
$form_state
->setErrorByName('name', t('The custom meta tag %tag already exists.', [
'%tag' => $form_state
->getValue('name'),
]));
}
}