In my Module’s Config I have set template map’s and path stack:
Mail/config/module.config.php
return [
'view_manager' => [
'template_map' => [
'test/index' => __DIR__ . '/../view/mail/test/index.phtml',
],
'template_path_stack' => [
'mail' => __DIR__ . '/../view/',
],
],
];
But it looks like that this configuration is not included if I call the PhpRenderer()
manually:
Mail.php Class
<?php
class Mail {
protected $renderer;
protected $mailHtmlView;
public function render()
{
$this->renderer = new PhpRenderer();
$this->mailHtmlView = new ViewModel();
$this->mailHtmlView->setTemplate('xyz');
$res = $this->renderer->render($this->mailHtmlView);
}
Always ends up in error:
Laminas\View\Renderer\PhpRenderer::render: Unable to render template "xyz"; resolver could not resolve to a file
It looks like if using the PhpRenderer it doesn’t include the Modules Config. How can I make the Template Map and Template Stack which is included in the Module’s config available to the PhpRenderer() ?