You are here

public static function Drupal::l in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal.php \Drupal::l()

Renders a link with a given link text and Url object.

This method is a convenience wrapper for the link generator service's generate() method. For detailed documentation, see \Drupal\Core\Routing\LinkGeneratorInterface::generate().

Parameters

string $text: The link text for the anchor tag.

\Drupal\Core\Url $url: The URL object used for the link.

Return value

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

See also

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

\Drupal\Core\Url

59 calls to Drupal::l()
block_help in core/modules/block/block.module
Implements hook_help().
BookTest::checkBookNode in core/modules/book/src/Tests/BookTest.php
Checks the outline of sub-pages; previous, up, and next.
CommentLinksTest::testLinkApprove in core/modules/comment/src/Tests/Views/CommentLinksTest.php
Test the comment approve link.
CommentLinksTest::testLinkReply in core/modules/comment/src/Tests/Views/CommentLinksTest.php
Test the comment reply link.
DbLogTest::verifyLinkEscaping in core/modules/dblog/src/Tests/DbLogTest.php
Tests the escaping of links in the operation row of a database log detail page.

... See full list

File

core/lib/Drupal.php, line 574
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function l($text, Url $url) {
  return static::getContainer()
    ->get('link_generator')
    ->generate($text, $url);
}