You are here

public function VideoEmbedDialog::validateForm in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 modules/video_embed_wysiwyg/src/Form/VideoEmbedDialog.php \Drupal\video_embed_wysiwyg\Form\VideoEmbedDialog::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

modules/video_embed_wysiwyg/src/Form/VideoEmbedDialog.php, line 161

Class

VideoEmbedDialog
A class for a video embed dialog.

Namespace

Drupal\video_embed_wysiwyg\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $provider = $this
    ->getProvider($form_state
    ->getValue('video_url'));

  // Display an error if no provider can be loaded for this video.
  if (FALSE == $provider) {
    $form_state
      ->setError($form['video_url'], $this
      ->t('Could not find a video provider to handle the given URL.'));
    return;
  }
}