You are here

public function StyleguidePluginBase::buildLinkFromRoute in Style Guide 8

Same name and namespace in other branches
  1. 2.x src/Plugin/StyleguidePluginBase.php \Drupal\styleguide\Plugin\StyleguidePluginBase::buildLinkFromRoute()

Build a link from a given route name and parameters.

Parameters

string $text: Text displayed in 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.

Return value

array The renderable array.

1 call to StyleguidePluginBase::buildLinkFromRoute()
DefaultStyleguide::items in src/Plugin/Styleguide/DefaultStyleguide.php
Styleguide elements implementation.

File

src/Plugin/StyleguidePluginBase.php, line 48

Class

StyleguidePluginBase
Base class for Styleguide plugins.

Namespace

Drupal\styleguide\Plugin

Code

public function buildLinkFromRoute($text, $route_name, array $route_parameters = [], array $options = []) {
  $link = Link::createFromRoute($text, $route_name, $route_parameters, $options);
  return $link
    ->toRenderable();
}