Commit f08e28ad authored by alexpott's avatar alexpott

Issue #2496801 by cilefen, Cottser: Change setGenerators to setUrlGenerator on TwigExtension

parent 18cc89f1
......@@ -1310,7 +1310,7 @@ services:
tags:
- { name: twig.extension, priority: 100 }
calls:
- [setGenerators, ['@url_generator']]
- [setUrlGenerator, ['@url_generator']]
- [setThemeManager, ['@theme.manager']]
# @todo Figure out what to do about debugging functions.
# @see https://www.drupal.org/node/1804998
......
......@@ -65,8 +65,23 @@ public function __construct(RendererInterface $renderer) {
* The URL generator.
*
* @return $this
*
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
* Use \Drupal\Core\Template\TwigExtension::setUrlGenerator().
*/
public function setGenerators(UrlGeneratorInterface $url_generator) {
return $this->setUrlGenerator($url_generator);
}
/**
* Sets the URL generator.
*
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The URL generator.
*
* @return $this
*/
public function setUrlGenerator(UrlGeneratorInterface $url_generator) {
$this->urlGenerator = $url_generator;
return $this;
}
......
......@@ -32,7 +32,7 @@ public function testEscaping($template, $expected) {
'autoescape' => TRUE,
'optimizations' => 0
));
$twig->addExtension((new TwigExtension($renderer))->setGenerators($this->getMock('Drupal\Core\Routing\UrlGeneratorInterface')));
$twig->addExtension((new TwigExtension($renderer))->setUrlGenerator($this->getMock('Drupal\Core\Routing\UrlGeneratorInterface')));
$nodes = $twig->parse($twig->tokenize($template));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment