You are here

public function StyleguidePluginBase::buildLink in Style Guide 8

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

Build a link.

Parameters

string $text: Text displayed in the link.

string $uri: Url used in the link.

Return value

string The renderable array.

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

File

src/Plugin/StyleguidePluginBase.php, line 27

Class

StyleguidePluginBase
Base class for Styleguide plugins.

Namespace

Drupal\styleguide\Plugin

Code

public function buildLink($text, $uri) {
  $url = Url::fromUserInput($uri);
  $link = Link::fromTextAndUrl($text, $url);
  return $link
    ->toRenderable();
}