コード例 #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testResolveWithoutDefaultSuffix()
 {
     $this->object->setDefaultSuffix('.bar');
     $this->object->addPath(__DIR__ . '/_templates');
     $markup = $this->object->resolve('two.phtml');
     $this->assertEquals(__DIR__ . '/_templates/two.phtml.bar', $markup);
 }
コード例 #2
0
 /**
  * Create the template map view resolver
  *
  * Creates a Zend\View\Resolver\TemplatePathStack and populates it with the
  * ['view_manager']['template_path_stack'] and sets the default suffix with the
  * ['view_manager']['default_template_suffix']
  *
  * @param ServiceLocatorInterface $serviceLocator Service Locator
  *
  * @return TemplatePathStack
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $templatePathStack = new TemplatePathStack();
     if (is_array($config) && isset($config['view_manager'])) {
         $config = $config['view_manager'];
         if (is_array($config)) {
             if (isset($config['template_path_stack'])) {
                 $templatePathStack->addPaths($config['template_path_stack']);
             }
             if (isset($config['default_template_suffix'])) {
                 $templatePathStack->setDefaultSuffix($config['default_template_suffix']);
             }
         }
     }
     return $templatePathStack;
 }