You are here

public static function Link::createFromRoute in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Link.php \Drupal\Core\Link::createFromRoute()

Creates a Link object from a given route name and parameters.

Parameters

string $text: The text of the link.

string $route_name: The name of the route

array $route_parameters: (optional) An associative array of parameter names and values.

array $options: The options parameter takes exactly the same structure. See \Drupal\Core\Url::fromUri() for details.

Return value

static

22 calls to Link::createFromRoute()
BookBreadcrumbBuilder::build in core/modules/book/src/BookBreadcrumbBuilder.php
Builds the breadcrumb.
CommentBreadcrumbBuilder::build in core/modules/comment/src/CommentBreadcrumbBuilder.php
Builds the breadcrumb.
EntityController::addPage in core/lib/Drupal/Core/Entity/Controller/EntityController.php
Displays add links for the available bundles.
EntityLinkTest::testToLink in core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
Tests for the Entity::toLink() method
ForumBreadcrumbBuilderBase::build in core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
Builds the breadcrumb.

... See full list

File

core/lib/Drupal/Core/Link.php, line 62

Class

Link
Defines an object that holds information about a link.

Namespace

Drupal\Core

Code

public static function createFromRoute($text, $route_name, $route_parameters = [], $options = []) {
  return new static($text, new Url($route_name, $route_parameters, $options));
}