public function GoogleImageSitemapCreateForm::validateForm in Google Image Sitemap 8
Same name and namespace in other branches
- 2.0.x src/Form/GoogleImageSitemapCreateForm.php \Drupal\google_image_sitemap\Form\GoogleImageSitemapCreateForm::validateForm()
- 1.0.x src/Form/GoogleImageSitemapCreateForm.php \Drupal\google_image_sitemap\Form\GoogleImageSitemapCreateForm::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/ GoogleImageSitemapCreateForm.php, line 67
Class
- GoogleImageSitemapCreateForm
- Provides a form to create new sitemap.
Namespace
Drupal\google_image_sitemap\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// Check for valid url.
if ($form_state
->getValue([
'license',
]) && !UrlHelper::isValid($form_state
->getValue([
'license',
]), TRUE)) {
$form_state
->setErrorByName('license', $this
->t('License should be a valid url.'));
}
}