/** * Gets the 'twig.extension' service. * * This service is shared. * This method always returns the same instance of the service. * * @return \Drupal\Core\Template\TwigExtension A Drupal\Core\Template\TwigExtension instance. */ protected function getTwig_ExtensionService() { $this->services['twig.extension'] = $instance = new \Drupal\Core\Template\TwigExtension($this->get('renderer')); $instance->setGenerators($this->get('url_generator')); $instance->setLinkGenerator($this->get('link_generator')); $instance->_serviceId = 'twig.extension'; return $instance; }
/** * Gets the 'twig' service. * * This service is shared. * This method always returns the same instance of the service. * * @return Drupal\Core\Template\TwigEnvironment A Drupal\Core\Template\TwigEnvironment instance. */ protected function getTwigService() { $a = new \Drupal\Core\Template\TwigExtension(); $a->setGenerators($this->get('url_generator')); $this->services['twig'] = $instance = new \Drupal\Core\Template\TwigEnvironment($this->get('twig.loader.filesystem'), array('cache' => false, 'autoescape' => true, 'debug' => false, 'auto_reload' => NULL), $this->get('module_handler'), $this->get('theme_handler')); $instance->addExtension($a); $instance->addExtension(new \Twig_Extension_Debug()); return $instance; }