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

Gets the URL generator.

Return value

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

2 calls to Url::urlGenerator()
Url::getInternalPath in core/lib/Drupal/Core/Url.php
Returns the internal path (system path) for this route.
Url::toString in core/lib/Drupal/Core/Url.php
Generates the string URL representation for this Url object.

File

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

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;
}