function Drupal::urlGenerator

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::urlGenerator()
  2. 10 core/lib/Drupal.php \Drupal::urlGenerator()
  3. 11.x core/lib/Drupal.php \Drupal::urlGenerator()

Returns the url generator service.

Return value

\Drupal\Core\Routing\UrlGeneratorInterface The url generator service.

4 calls to Drupal::urlGenerator()
DrupalTest::testUrlGenerator in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the urlGenerator() method.
RouteNoneTest::setUp in core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php
RouteProcessorCurrentIntegrationTest::setUp in core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
Url::urlGenerator in core/lib/Drupal/Core/Url.php
Gets the URL generator.

File

core/lib/Drupal.php, line 551

Class

Drupal
Static Service Container wrapper.

Code

public static function urlGenerator() {
    return static::getContainer()->get('url_generator');
}

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