public function InviteConfig::validateForm in Invite 8
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/ InviteConfig.php, line 93
Class
- InviteConfig
- Class InviteConfig.
Namespace
Drupal\invite\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$route_name = $form_state
->getValue('accept_redirect');
$route_exists = count($this->routeProvider
->getRoutesByNames([
$route_name,
])) === 1;
if (!$route_exists) {
$form_state
->setErrorByName('accept_redirect', $this
->t('Route "@route" does not exist.', [
'@route' => $route_name,
]));
}
}