Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Link.php

function Link::createFromRoute

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

Parameters

string|array|\Drupal\Component\Render\MarkupInterface $text: The link text for the anchor tag as a translated string or render array. Strings will be sanitized automatically. If you need to output HTML in the link text, use a render array or an already sanitized string such as the output of \Drupal\Component\Utility\Xss::filter() or \Drupal\Component\Render\FormattableMarkup.

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

10 calls to Link::createFromRoute()
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.
HelpBreadcrumbBuilder::build in core/modules/help/src/HelpBreadcrumbBuilder.php
Builds the breadcrumb.
HelpTopicPluginBase::toLink in core/modules/help/src/HelpTopicPluginBase.php
Returns a link for viewing the help topic.
HookHelpSection::listTopics in core/modules/help/src/Plugin/HelpSection/HookHelpSection.php
Returns a list of topics to show in the help section.

... See full list

File

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

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));
}
RSS feed
Powered by Drupal