Closed samuelnogueira closed 6 years ago
I'm trying to set default params for child templates.
use Zend\Expressive\Template\TemplateRendererInterface; use Zend\View\Model\ViewModel; /** @var \Zend\Expressive\ZendView\ZendViewRenderer $renderer */ $renderer->addDefaultParam(TemplateRendererInterface::TEMPLATE_ALL, 'user', 'john.doe'); echo $renderer->render( 'my-view', (new ViewModel)->addChild( (new ViewModel)->setTemplate('my-sub-view'), 'sub' ) ); // assume 'my-view' template to be: '<?php echo $this->sub;' // assume 'my-sub-view' template to be: '<?php echo $this->user;'
john.doe string echoed
john.doe
null/empty string echoed
I'm trying to set default params for child templates.
Code to reproduce the issue
Expected results
john.doe
string echoedActual results
null/empty string echoed