protected function UrlResolver::getEndpointMatchingUrl in Drupal 9
For the given media item URL find an endpoint with schemes that match.
Parameters
string $url: The media URL used to lookup the matching endpoint.
\Drupal\media\OEmbed\Provider $provider: The oEmbed provider for the asset.
Return value
string The resource url.
1 call to UrlResolver::getEndpointMatchingUrl()
- UrlResolver::getResourceUrl in core/
modules/ media/ src/ OEmbed/ UrlResolver.php - Builds the resource URL for a media asset URL.
File
- core/
modules/ media/ src/ OEmbed/ UrlResolver.php, line 200
Class
- UrlResolver
- Converts oEmbed media URLs into endpoint-specific resource URLs.
Namespace
Drupal\media\OEmbedCode
protected function getEndpointMatchingUrl($url, Provider $provider) {
$endpoints = $provider
->getEndpoints();
$resource_url = reset($endpoints)
->buildResourceUrl($url);
foreach ($endpoints as $endpoint) {
if ($endpoint
->matchUrl($url)) {
$resource_url = $endpoint
->buildResourceUrl($url);
break;
}
}
return $resource_url ?? reset($endpoints)
->buildResourceUrl($url);
}