You are here

public function LinkGenerator::generateFromLink in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Utility/LinkGenerator.php \Drupal\Core\Utility\LinkGenerator::generateFromLink()

Renders a link from a link object.

@internal Should not be used in user code. Use \Drupal\Core\Link instead.

Parameters

\Drupal\Core\Link $link: A link object to convert to a string.

Return value

\Drupal\Core\GeneratedLink A GeneratedLink object containing a link to the given route and parameters and bubbleable metadata.

Overrides LinkGeneratorInterface::generateFromLink

File

core/lib/Drupal/Core/Utility/LinkGenerator.php, line 67
Contains \Drupal\Core\Utility\LinkGenerator.

Class

LinkGenerator
Provides a class which generates a link with route names and parameters.

Namespace

Drupal\Core\Utility

Code

public function generateFromLink(Link $link) {
  return $this
    ->generate($link
    ->getText(), $link
    ->getUrl());
}