You are here

public function CKEditorMediaEmbedSettingsForm::validateForm in CKEditor Media Embed Plugin 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/CKEditorMediaEmbedSettingsForm.php, line 130

Class

CKEditorMediaEmbedSettingsForm
Class CKEditorMediaEmbedSettingsForm.

Namespace

Drupal\ckeditor_media_embed\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $embed_provider = $form_state
    ->getValue('embed_provider');
  $this
    ->prepareEmbedProviderValidation($embed_provider);
  if (!UrlHelper::isValid($embed_provider, TRUE)) {
    $form_state
      ->setErrorByName('embed_provider', $this
      ->t('The provider url was not valid.'));
  }
}