You are here

public function Resource::getUrl in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::getUrl()
  2. 9 core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::getUrl()

Returns the URL of the resource. Only applies to 'photo' resources.

Return value

\Drupal\Core\Url|null The resource URL, if it has one.

File

core/modules/media/src/OEmbed/Resource.php, line 467

Class

Resource
Value object representing an oEmbed resource.

Namespace

Drupal\media\OEmbed

Code

public function getUrl() {
  if ($this->url) {
    return Url::fromUri($this->url)
      ->setAbsolute();
  }
  return NULL;
}