/** * 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 \Twig_Loader_Chain(); $a->addLoader($this->get('twig.loader.filesystem')); $a->addLoader($this->get('twig.loader.theme_registry')); $a->addLoader($this->get('twig.loader.string')); $this->services['twig'] = $instance = new \Drupal\Core\Template\TwigEnvironment($this->get('app.root'), $this->get('cache.default'), $a, array('debug' => false, 'auto_reload' => NULL, 'cache' => true)); $instance->addExtension($this->get('twig.extension')); $instance->addExtension($this->get('twig.extension.debug')); $instance->_serviceId = 'twig'; 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() { $this->services['twig'] = $instance = new \Drupal\Core\Template\TwigEnvironment($this->get('twig.loader.filesystem'), array('cache' => true, 'autoescape' => true, 'debug' => false, 'auto_reload' => NULL), $this->get('module_handler'), $this->get('theme_handler')); $instance->addExtension(new \Drupal\Core\Template\TwigExtension()); $instance->addExtension(new \Twig_Extension_Debug()); return $instance; }