protected function UrlResolver::findUrl in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media/src/OEmbed/UrlResolver.php \Drupal\media\OEmbed\UrlResolver::findUrl()
- 9 core/modules/media/src/OEmbed/UrlResolver.php \Drupal\media\OEmbed\UrlResolver::findUrl()
Tries to find the oEmbed URL in a DOM.
Parameters
\DOMXPath $xpath: Page HTML as DOMXPath.
string $format: Format of oEmbed resource. Possible values are 'json' and 'xml'.
Return value
bool|string A URL to an oEmbed resource or FALSE if not found.
1 call to UrlResolver::findUrl()
- UrlResolver::discoverResourceUrl in core/
modules/ media/ src/ OEmbed/ UrlResolver.php - Runs oEmbed discovery and returns the endpoint URL if successful.
File
- core/
modules/ media/ src/ OEmbed/ UrlResolver.php, line 118
Class
- UrlResolver
- Converts oEmbed media URLs into endpoint-specific resource URLs.
Namespace
Drupal\media\OEmbedCode
protected function findUrl(\DOMXPath $xpath, $format) {
$result = $xpath
->query("//link[@type='application/{$format}+oembed']");
return $result->length ? $result
->item(0)
->getAttribute('href') : FALSE;
}