Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…dChild support
  • Loading branch information
kusmierz committed May 19, 2016
1 parent f9f18a4 commit eaf04e7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ZfcTwig/View/TwigRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,19 @@ public function render($nameOrModel, $values = array())
if (!isset($values['content'])) {
$values['content'] = '';
}
foreach($model as $child) {
foreach ($model as $child) {
/** @var \Zend\View\Model\ViewModel $child */
if ($this->canRender($child->getTemplate())) {
$template = $this->resolver->resolve($child->getTemplate(), $this);
return $template->render((array) $child->getVariables());

$childValues = (array) $child->getVariables();
if ($child->hasChildren()) {
foreach ($child->getChildren() as $grandChild) {
$childValues[$grandChild->captureTo()] = $this->render($grandChild);
}
}

return $template->render($childValues);
}
$child->setOption('has_parent', true);
$values['content'] .= $this->view->render($child);
Expand Down

0 comments on commit eaf04e7

Please sign in to comment.