You are here

protected function LinkGeneratorTrait::getLinkGenerator in Drupal 8

Returns the link generator.

Return value

\Drupal\Core\Utility\LinkGeneratorInterface The link generator

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the 'link_generator' service or use \Drupal\Core\Link instead

See also

https://www.drupal.org/node/2614344

File

core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php, line 62

Class

LinkGeneratorTrait
Wrapper methods for the Link Generator.

Namespace

Drupal\Core\Routing

Code

protected function getLinkGenerator() {
  @trigger_error(__NAMESPACE__ . "\\LinkGeneratorTrait::getLinkGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the 'link_generator' service or use \\Drupal\\Core\\Link instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
  if (!isset($this->linkGenerator)) {
    $this->linkGenerator = \Drupal::service('link_generator');
  }
  return $this->linkGenerator;
}