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

Returns the URL generator service.

Return value

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

9 calls to Drupal::urlGenerator()
DrupalTest::testUrlGenerator in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the urlGenerator() method.
FunctionsTest::testIndexedKeyedLinks in core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php
Tests links.html.twig using links with indexed keys.
FunctionsTest::testLinks in core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php
Tests links.html.twig.
RenderElementTypesTest::testMoreLink in core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
Tests system #type 'more_link'.
RouteNoneTest::setUp in core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php

... See full list

File

core/lib/Drupal.php, line 576

Class

Drupal
Static Service Container wrapper.

Code

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