function TwigExtension::getFileUrl

Same name in other branches
  1. 9 core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::getFileUrl()
  2. 10 core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::getFileUrl()

Gets the file URL.

Parameters

string|null $uri: The file URI.

Return value

string The file URL.

File

core/lib/Drupal/Core/Template/TwigExtension.php, line 287

Class

TwigExtension
A class providing Drupal Twig extensions.

Namespace

Drupal\Core\Template

Code

public function getFileUrl(?string $uri) : string {
    if (is_null($uri)) {
        return '';
    }
    return $this->fileUrlGenerator
        ->generateString($uri);
}

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