Details
-
Bug
-
Resolution: Fixed
-
High
-
5.2-beta1
Description
When doing a ez_content:viewLocation sub-request, it is possible to pass extra parameters to the sub-ViewController. These extra parameters will then be passed to the underlying ViewProvider.
This is basically what was possible in legacy when doing node_view_gui. See legacy documentation on this.
This works perfectly when using Twig templates as variables are correctly passed, but when you fallback to legacy rendering, those parameters are passed as user parameters which then are merged into $view_parameters template variable.
Direct consequence is that needed variables cannot be accessed directly, but only through $view_parameters.my_var (instead of just $my_var.
Example
From a Twig template, we do a sub-request to display a location and we don't have a Twig template yet for it (so fallback to legacy ViewProvider\Location).
{{ render( controller( "ez_content:viewLocation", { "locationId": someLocationId, "viewType": "block_item", "params": {"image_class": "contentgrid"} } ) ) }}
Legacy template:
{* We expect $image_class to be available *} Expected image class: {$image_class} (will be null) What we have: {$view_parameters.image_class} (will be "contentgrid")