You are here

public function OembedProvidersSettingsForm::validateForm in oEmbed Providers 1.1.x

Same name and namespace in other branches
  1. 2.x src/Form/OembedProvidersSettingsForm.php \Drupal\oembed_providers\Form\OembedProvidersSettingsForm::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/OembedProvidersSettingsForm.php, line 104

Class

OembedProvidersSettingsForm
Configure oEmbed settings form.

Namespace

Drupal\oembed_providers\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if ($form_state
    ->getValue('oembed_providers_url') === '' && $form_state
    ->getValue('external_fetch') === 1) {
    $form_state
      ->setErrorByName('oembed_providers_url', $this
      ->t('The <em>oEmbed Providers URL</em> field is required.'));
  }
}