function Url::setUrlGenerator

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

Sets the URL generator.

Parameters

\Drupal\Core\Routing\UrlGeneratorInterface $url_generator: (optional) The URL generator, specify NULL to reset it.

Return value

$this

File

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

Class

Url
Defines an object that holds information about a URL.

Namespace

Drupal\Core

Code

public function setUrlGenerator(?UrlGeneratorInterface $url_generator = NULL) {
    $this->urlGenerator = $url_generator;
    $this->internalPath = NULL;
    return $this;
}

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