function UrlResolver::findUrl
Same name in other branches
- 8.9.x core/modules/media/src/OEmbed/UrlResolver.php \Drupal\media\OEmbed\UrlResolver::findUrl()
- 10 core/modules/media/src/OEmbed/UrlResolver.php \Drupal\media\OEmbed\UrlResolver::findUrl()
- 11.x 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 122
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.