W3cubDocs

/Drupal 8

protected function LinkGeneratorTrait::l

protected 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()

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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!LinkGeneratorTrait.php/function/LinkGeneratorTrait::l/8.1.x