@@ -84,12 +84,10 @@ public static function &getModule($name, $title = null)
8484 public static function &getModules ($ position )
8585 {
8686 $ position = strtolower ($ position );
87- $ result = array ();
88- $ input = Factory::getApplication ()->input ;
89-
90- $ modules =& static ::load ();
91-
92- $ total = \count ($ modules );
87+ $ result = array ();
88+ $ input = Factory::getApplication ()->input ;
89+ $ modules = &static ::load ();
90+ $ total = \count ($ modules );
9391
9492 for ($ i = 0 ; $ i < $ total ; $ i ++)
9593 {
@@ -99,14 +97,16 @@ public static function &getModules($position)
9997 }
10098 }
10199
102- if (\count ($ result ) === 0 )
100+ // Prepend a dummy module for template preview
101+ if ($ input ->getBool ('tp ' ) && ComponentHelper::getParams ('com_templates ' )->get ('template_positions_display ' ))
103102 {
104- if ($ input ->getBool ('tp ' ) && ComponentHelper::getParams ('com_templates ' )->get ('template_positions_display ' ))
105- {
106- $ result [0 ] = static ::createDummyModule ();
107- $ result [0 ]->title = $ position ;
108- $ result [0 ]->position = $ position ;
109- }
103+ $ dummy = static ::createDummyModule ();
104+ $ dummy ->title = $ position ;
105+ $ dummy ->position = $ position ;
106+ $ dummy ->content = $ position ;
107+ $ dummy ->contentRendered = true ;
108+
109+ array_unshift ($ result , $ dummy );
110110 }
111111
112112 return $ result ;
0 commit comments