UrlResolver.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/media/src/OEmbed/UrlResolver.php
- 9 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php
- 8.9.x core/modules/media/src/OEmbed/UrlResolver.php
- 8.9.x core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php
- 10 core/modules/media/src/OEmbed/UrlResolver.php
- 10 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php
Namespace
Drupal\media_test_oembedFile
-
core/
modules/ media/ tests/ modules/ media_test_oembed/ src/ UrlResolver.php
View source
<?php
declare (strict_types=1);
namespace Drupal\media_test_oembed;
use Drupal\media\OEmbed\UrlResolver as BaseUrlResolver;
/**
* Overrides the oEmbed URL resolver service for testing purposes.
*/
class UrlResolver extends BaseUrlResolver {
/**
* Sets the endpoint URL for an oEmbed resource URL.
*
* @param string $url
* The resource URL.
* @param string $endpoint_url
* The endpoint URL.
*/
public static function setEndpointUrl($url, $endpoint_url) {
$urls = \Drupal::state()->get(static::class, []);
$urls[$url] = $endpoint_url;
\Drupal::state()->set(static::class, $urls);
}
/**
* {@inheritdoc}
*/
public function getResourceUrl($url, $max_width = NULL, $max_height = NULL) {
$urls = \Drupal::state()->get(static::class, []);
if (isset($urls[$url])) {
return $urls[$url];
}
return parent::getResourceUrl($url, $max_width, $max_height);
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
UrlResolver | Overrides the oEmbed URL resolver service for testing purposes. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.