This question has been tormenting for a long time, there is a presentation, for example, a "catalog of goods", when we go to the */catalog page, then the materials open in a list.

How to make that when you click on the appropriate icon (which we insert in the right place) the goods are opened with tiles.

I think that it is possible to substitute an argument to the address, for example: */catalog?big (so that views still understand what needs to be output if we clicked on a direct link), that is, the format is selected by default in the view: “table> fields "If you clicked on the corresponding zanachek, and the address took the form of the type: */catalog?big , then the presentation should be displayed in the format:" unformatted list, an entity ready for output ".

I read the views API but so far to no avail, tell me where to dig? Maybe there is a hook that prints the presentation code, having been inserted into which it will be possible to change the format depending on the conditions?

Now I know a way only with the help of js and css, but it’s wrong to customize styles, if, when changing the format, I need to rebuild the html structure of the reflection of the type of material.

    2 answers 2

    It is necessary to make two necessary displays. Install the module https://www.drupal.org/project/views_modes and configure the Filter (exposed filter) to display.

    Additionally can be useful: http://gbyte.co/blog/simple-views-display-switch

    • minus in contextual filtering on the taxonomy term, since the dictionary clings only to one reflection, if this is not done, and configured only in the view, then the term will be filtered by the term that is attached to the dictionary, and the second will always display emptiness. Ideally this is when, depending on the condition, the format will change inside one reflection. 3 days of intensive searches and sitting on forms prompted the need to change the format in the very topic of the presentation. ...... tpl.php - Evgeny Shevtsov

    I think we need to create an additional display in this Views (not separate views, so that the settings are related) and override its output format. And accordingly, it will have a completely different URL. The method is simple and does not require any coding.

    • no separate urls, search engines will definitely not like it - Evgeny Shevtsov