Skip to content

Commit

Permalink
BUGFIX: Pass arguments through to subtemplates when rendering those too
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamish Friedlander committed Apr 11, 2012
1 parent e4a043a commit 21bf409
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions view/SSViewer.php
Expand Up @@ -796,7 +796,10 @@ public function process($item, $arguments = null) {
if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process - compile", " for $template");
}

$internalArguments = array('I18NNamespace' => basename($template));
$templateSpecificGlobals = array('I18NNamespace' => basename($template));
$arguments = $arguments ? array_merge($templateSpecificGlobals, $arguments) : $templateSpecificGlobals;

$subtemplateGlobals = array();

// Makes the rendered sub-templates available on the parent item,
// through $Content and $Layout placeholders.
Expand All @@ -805,11 +808,11 @@ public function process($item, $arguments = null) {
$subtemplateViewer = new SSViewer($this->chosenTemplates[$subtemplate]);
$subtemplateViewer->setPartialCacheStore($this->getPartialCacheStore());

$internalArguments[$subtemplate] = $subtemplateViewer->process($item);
$subtemplateGlobals[$subtemplate] = $subtemplateViewer->process($item, $arguments);
}
}

$val = $this->includeGeneratedTemplate($cacheFile, $item, $arguments ? array_merge($internalArguments, $arguments) : $internalArguments);
$val = $this->includeGeneratedTemplate($cacheFile, $item, array_merge($subtemplateGlobals, $arguments));
$output = Requirements::includeInHTML($template, $val);

array_pop(SSViewer::$topLevel);
Expand Down

0 comments on commit 21bf409

Please sign in to comment.