public function BrokenLinkRedirectForm::validateForm in Broken Link 8.2
Same name and namespace in other branches
- 8.3 src/Form/BrokenLinkRedirectForm.php \Drupal\broken_link\Form\BrokenLinkRedirectForm::validateForm()
- 8 src/Form/BrokenLinkRedirectForm.php \Drupal\broken_link\Form\BrokenLinkRedirectForm::validateForm()
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/ BrokenLinkRedirectForm.php, line 105
Class
- BrokenLinkRedirectForm
- Class BrokenLinkRedirectForm.
Namespace
Drupal\broken_link\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$redirect_path = $form_state
->getValue('redirect_path');
$is_valid = $this->pathValidator
->isValid($redirect_path);
if (!$is_valid) {
$form_state
->setError($form['redirect_path'], 'Please enter valid redirect path.');
}
elseif (UrlHelper::isExternal($redirect_path)) {
$form_state
->setError($form['redirect_path'], 'External redirect path is not allowed.');
}
}