Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UrlResolver.php

function 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 120

Class

UrlResolver
Converts oEmbed media URLs into endpoint-specific resource URLs.

Namespace

Drupal\media\OEmbed

Code

protected function findUrl(\DOMXPath $xpath, $format) {
    $result = $xpath->query("//link[@type='application/{$format}+oembed']");
    return $result->length ? $result->item(0)
        ->getAttribute('href') : FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal