8.5.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.0.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.1.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.2.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.3.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.4.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)
8.6.x LinkGeneratorTrait.php LinkGeneratorTrait::l($text, Url $url)

Renders a link to a route given a route name and its parameters.

For details on the arguments, usage, and possible exceptions see \Drupal\Core\Utility\LinkGeneratorInterface::generate().

Return value

\Drupal\Core\GeneratedLink A GeneratedLink object containing a link to the given route and parameters and bubbleable metadata.

Deprecated

in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Link instead.

See also

\Drupal\Core\Utility\LinkGeneratorInterface::generate()

13 calls to LinkGeneratorTrait::l()
BookController::adminOverview in core/modules/book/src/Controller/BookController.php
Returns an administrative overview of all books.
BookController::bookRender in core/modules/book/src/Controller/BookController.php
Prints a listing of all books.
CommentForm::save in core/modules/comment/src/CommentForm.php
Form submission handler for the 'save' action.
ContentTranslationController::overview in core/modules/content_translation/src/Controller/ContentTranslationController.php
Builds the translations overview page.
DbLogController::eventDetails in core/modules/dblog/src/Controller/DbLogController.php
Displays details about a specific database log message.

... See full list

File

core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php, line 44

Class

LinkGeneratorTrait
Wrapper methods for the Link Generator.

Namespace

Drupal\Core\Routing

Code

protected function l($text, Url $url) {
  return $this
    ->getLinkGenerator()
    ->generate($text, $url);
}