I'm implementing View (controller by AJAX) for Commerce project and would like to have the ability to display Commerce Products in two viewmodes in my View. I was thinking about using Contextual Filters to accept "viewmode" query parameter and then in hook_views_post_execute I would change the viewmode of results according to query parameter (this information can be found in view object in this hook).

The issue is I could not find Filter / Contextual Filter for viewmode so I was thinking about creating Custom View Filter, but then I realized that these Custom Filters perform queries above entities and that is something I don't need, since my only motivation is to call View's URL by AJAX (with Facets query parameters) and change viewmode based on query parameter.

Please what would be the best approach to create custom Radio / Toggle Filter that fires View's AJAX request and returns results in different viewmode based on query string parameter?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.