public function SettingsForm::validateForm in Stage File Proxy 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/ SettingsForm.php, line 116
Class
- SettingsForm
- Provide settings for Stage File Proxy.
Namespace
Drupal\stage_file_proxy\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$origin = $form_state
->getValue('origin');
if (!empty($origin) && filter_var($origin, FILTER_VALIDATE_URL) === FALSE) {
$form_state
->setErrorByName('origin', 'Origin needs to be a valid URL.');
}
}