Exemplo n.º 1
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Configuration');
     $config = $config['zfctwig'];
     $pathResolver = $serviceLocator->get('ViewTemplatePathStack');
     $pathResolver->setDefaultSuffix($config['suffix']);
     $resolver = $serviceLocator->get('ViewResolver');
     $renderer = new Renderer();
     $renderer->setEngine($serviceLocator->get('TwigEnvironment'));
     $renderer->setResolver($resolver);
     return $renderer;
 }
 /**
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return \ZfcTwig\View\Renderer
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Configuration');
     $config = $config['zfctwig'];
     $renderer = new Renderer();
     $renderer->setSuffixLocked(isset($config['suffix_locked']) ? $config['suffix_locked'] : false);
     $renderer->setSuffix(isset($config['suffix']) ? $config['suffix'] : 'twig');
     $engine = $serviceLocator->get('TwigEnvironment');
     $renderer->setHelperPluginManager($engine->getManager());
     $renderer->setEngine($engine);
     $renderer->setResolver($serviceLocator->get('TwigViewResolver'));
     return $renderer;
 }