public function SettingsForm::validateForm in Font Awesome Icons 8
Same name and namespace in other branches
- 8.2 src/Form/SettingsForm.php \Drupal\fontawesome\Form\SettingsForm::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/ SettingsForm.php, line 100
Class
- SettingsForm
- Defines a form that configures fontawesome settings.
Namespace
Drupal\fontawesome\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
// Validate URL.
if (!empty($values['fontawesome_external_location']) && !UrlHelper::isValid($values['fontawesome_external_location'])) {
$form_state
->setErrorByName('fontawesome_external_location', $this
->t('Invalid external library location.'));
}
}