function OEmbed::validateConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::validateConfigurationForm()
  2. 10 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::validateConfigurationForm()
  3. 11.x core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::validateConfigurationForm()

Overrides MediaSourceBase::validateConfigurationForm

File

core/modules/media/src/Plugin/media/Source/OEmbed.php, line 364

Class

OEmbed
Provides a media source plugin for oEmbed resources.

Namespace

Drupal\media\Plugin\media\Source

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    $thumbnails_directory = $form_state->getValue('thumbnails_directory');
    
    /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */
    $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
    if (!$stream_wrapper_manager->isValidUri($thumbnails_directory)) {
        $form_state->setErrorByName('thumbnails_directory', $this->t('@path is not a valid path.', [
            '@path' => $thumbnails_directory,
        ]));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.