function Url::urlGenerator

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::urlGenerator()
  2. 8.9.x core/lib/Drupal/Core/Url.php \Drupal\Core\Url::urlGenerator()
  3. 10 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::urlGenerator()

Gets the URL generator.

Return value

\Drupal\Core\Routing\UrlGeneratorInterface The URL generator.

File

core/lib/Drupal/Core/Url.php, line 830

Class

Url
Defines an object that holds information about a URL.

Namespace

Drupal\Core

Code

protected function urlGenerator() {
    if (!$this->urlGenerator) {
        $this->urlGenerator = \Drupal::urlGenerator();
    }
    return $this->urlGenerator;
}

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