function Resource::getUrl

Same name in other branches
  1. 9 core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::getUrl()
  2. 8.9.x core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::getUrl()
  3. 10 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.