diff --git a/view/SSViewer.php b/view/SSViewer.php index 5c70b1beb01..d489457ba47 100644 --- a/view/SSViewer.php +++ b/view/SSViewer.php @@ -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);