public function UrlResolver::getResourceUrl in Drupal 10
Same name in this branch
- 10 core/modules/media/src/OEmbed/UrlResolver.php \Drupal\media\OEmbed\UrlResolver::getResourceUrl()
- 10 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php \Drupal\media_test_oembed\UrlResolver::getResourceUrl()
Same name and namespace in other branches
- 8 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php \Drupal\media_test_oembed\UrlResolver::getResourceUrl()
- 9 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php \Drupal\media_test_oembed\UrlResolver::getResourceUrl()
Builds the resource URL for a media asset URL.
Parameters
string $url: The media asset URL.
int $max_width: (optional) Maximum width of the oEmbed resource, in pixels.
int $max_height: (optional) Maximum height of the oEmbed resource, in pixels.
Return value
string Returns the resource URL corresponding to the given media item URL.
Overrides UrlResolver::getResourceUrl
File
- core/
modules/ media/ tests/ modules/ media_test_oembed/ src/ UrlResolver.php, line 29
Class
- UrlResolver
- Overrides the oEmbed URL resolver service for testing purposes.
Namespace
Drupal\media_test_oembedCode
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);
}