Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit e4b69cd

Browse files
committed
Fix template renderer factory
1 parent 6d7f4b3 commit e4b69cd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/ZendViewRendererFactory.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ public function __invoke(ContainerInterface $container) : ZendViewRenderer
6666
100
6767
);
6868

69+
$nsPathResolver = new NamespacedPathStackResolver();
70+
// Set default suffix
71+
if (isset($config['extension'])) {
72+
$nsPathResolver->setDefaultSuffix($config['extension']);
73+
}
74+
$resolver->attach(
75+
$nsPathResolver,
76+
0
77+
);
78+
6979
// Create or retrieve the renderer from the container
7080
$renderer = $container->has(PhpRenderer::class)
7181
? $container->get(PhpRenderer::class)
@@ -75,9 +85,8 @@ public function __invoke(ContainerInterface $container) : ZendViewRenderer
7585
// Inject helpers
7686
$this->injectHelpers($renderer, $container);
7787

78-
$defaultSuffix = $config['extension'] ?? $config['default_suffix'] ?? null;
7988
// Inject renderer
80-
$view = new ZendViewRenderer($renderer, $config['layout'] ?? null, $defaultSuffix);
89+
$view = new ZendViewRenderer($renderer, $nsPathResolver, $config['layout'] ?? null);
8190

8291
// Add template paths
8392
$allPaths = isset($config['paths']) && is_array($config['paths']) ? $config['paths'] : [];

0 commit comments

Comments
 (0)