Fixed Context params not being passed to widget

Jon W

Well-known member
Affected version
2.1 Beta 3
I've created identical widget positions on XF 2.0 and XF 2.1 and in XF 2.0 the context params seem to work fine and in XF 2.1 they don't seem to get passed at all.

Any ideas?
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.1.0 Beta 5).

Change log:
Ensure context params are passed into compiled widgets correctly.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Diff:
diff --git a/src/XF/Template/Templater.php b/src/XF/Template/Templater.php
index 35c71a3894..dc230ec113 100644
--- a/src/XF/Template/Templater.php
+++ b/src/XF/Template/Templater.php
@@ -1602,10 +1602,14 @@ public function widgetPosition($positionId, array $contextParams = [])
         $widgetContainer = $this->app->widget();
         $widgets = $widgetContainer->position($positionId, $contextParams);
 
+        $options = [
+            'context' => $contextParams
+        ];
+
         $output = '';
         foreach ($widgets AS $widget)
         {
-            $output .= $widgetContainer->getCompiledWidget($widget, $contextParams) . "\n";
+            $output .= $widgetContainer->getCompiledWidget($widget, $options) . "\n";
         }
 
         return $output;
 
Top Bottom