Permalink
Browse files

BUGFIX: Pass arguments through to subtemplates when rendering those too

  • Loading branch information...
1 parent e4a043a commit 21bf409b7bf81295deeb5eee645cb0fdd1e49f9d Hamish Friedlander committed Apr 11, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 view/SSViewer.php
View
@@ -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.
@@ -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);

0 comments on commit 21bf409

Please sign in to comment.