I came across a situation where being able to dynamically chose a different Views Display based on the contextual arguments was necessary. One solution is to allow an override property in ResultRow during render to switch the view/display and use hook_views_pre_render to add the override to the rows when needed.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views_field_view-view_display_row_override-2819945-2.patch | 2.16 KB | kducharm |
Comments
Comment #2
kducharm commentedA patch using ResultRow views_field_view__view_override and views_field_view__display_override
Sample hook_views_pre_render code:
Comment #3
damiankloip commentedHmm, not sure we want this kind of 'magic' property checked on the value object. Another suggestion, how about we refactor the Field plugin slightly so there is a method just to get the view id and display id. You could then extend the plugin class to add your own behaviour for this.
Comment #4
kducharm commented@damiankloip I like that idea... this was definitely just a patch idea to get the ball rolling, will see if I can find bandwidth to make some getter/setters in the class so it can be extended.
Comment #5
jibranNW for #3.