function Drupal::urlGenerator

Same name in other branches
  1. 8.9.x 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 583

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.