function LinkGeneratorTrait::setLinkGenerator

Sets the link generator service.

Parameters

\Drupal\Core\Utility\LinkGeneratorInterface $generator: The link generator service.

Return value

$this

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 83

Class

LinkGeneratorTrait
Wrapper methods for the Link Generator.

Namespace

Drupal\Core\Routing

Code

public function setLinkGenerator(LinkGeneratorInterface $generator) {
    @trigger_error(__NAMESPACE__ . "\\LinkGeneratorTrait::setLinkGenerator() 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);
    $this->linkGenerator = $generator;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.