public static function Link::createFromRoute in Zircon Profile 8.0
Same name and namespace in other branches
- 8 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: (optional) An associative array of additional options, with the following elements:
- 'query': An array of query key/value-pairs (without any URL-encoding) to append to the URL. Merged with the parameters array.
- 'fragment': A fragment identifier (named anchor) to append to the URL. Do not include the leading '#' character.
- 'absolute': Defaults to FALSE. Whether to force the output to be an absolute link (beginning with http:). Useful for links that will be displayed outside the site, such as in an RSS feed.
- 'language': An optional language object used to look up the alias for the URL. If $options['language'] is omitted, it defaults to the current language for the language type LanguageInterface::TYPE_URL.
- 'https': Whether this URL should point to a secure location. If not defined, the current scheme is used, so the user stays on HTTP or HTTPS respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
Return value
static
16 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.
- 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.
- ForumBreadcrumbBuilderBaseTest::testBuild in core/
modules/ forum/ tests/ src/ Unit/ Breadcrumb/ ForumBreadcrumbBuilderBaseTest.php - Tests ForumBreadcrumbBuilderBase::build().
File
- core/
lib/ Drupal/ Core/ Link.php, line 78 - Contains \Drupal\Core\Link.
Class
- Link
- Defines an object that holds information about a link.
Namespace
Drupal\CoreCode
public static function createFromRoute($text, $route_name, $route_parameters = array(), $options = array()) {
return new static($text, new Url($route_name, $route_parameters, $options));
}