Skip to content
This repository
Browse code

BUGFIX: Pass arguments through to subtemplates when rendering those too

  • Loading branch information...
commit 21bf409b7bf81295deeb5eee645cb0fdd1e49f9d 1 parent e4a043a
Hamish Friedlander authored April 11, 2012

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. 9  view/SSViewer.php
9  view/SSViewer.php
@@ -796,7 +796,10 @@ public function process($item, $arguments = null) {
796 796
 			if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process - compile", " for $template");
797 797
 		}
798 798
 
799  
-		$internalArguments = array('I18NNamespace' => basename($template));
  799
+		$templateSpecificGlobals = array('I18NNamespace' => basename($template));
  800
+		$arguments = $arguments ? array_merge($templateSpecificGlobals, $arguments) : $templateSpecificGlobals;
  801
+
  802
+		$subtemplateGlobals = array();
800 803
 
801 804
 		// Makes the rendered sub-templates available on the parent item,
802 805
 		// through $Content and $Layout placeholders.
@@ -805,11 +808,11 @@ public function process($item, $arguments = null) {
805 808
 				$subtemplateViewer = new SSViewer($this->chosenTemplates[$subtemplate]);
806 809
 				$subtemplateViewer->setPartialCacheStore($this->getPartialCacheStore());
807 810
 
808  
-				$internalArguments[$subtemplate] = $subtemplateViewer->process($item);
  811
+				$subtemplateGlobals[$subtemplate] = $subtemplateViewer->process($item, $arguments);
809 812
 			}
810 813
 		}
811 814
 
812  
-		$val = $this->includeGeneratedTemplate($cacheFile, $item, $arguments ? array_merge($internalArguments, $arguments) : $internalArguments);
  815
+		$val = $this->includeGeneratedTemplate($cacheFile, $item, array_merge($subtemplateGlobals, $arguments));
813 816
 		$output = Requirements::includeInHTML($template, $val);
814 817
 		
815 818
 		array_pop(SSViewer::$topLevel);

0 notes on commit 21bf409

Please sign in to comment.
Something went wrong with that request. Please try again.