Creating nested lists with panelizer and view panes
Creating nested lists with panelizer and view panes
Marc Pfändler
Thu, 06/25/2015 - 15:00
For one of our customer projects, we wanted to have a list with all past projects. There are two types of projects selected among applicants every year: a winner and there are several finalists or runner ups. The idea was to show the winner of each year followed by the finalists/runner ups of the year. This should be done in a list where the actual year is the top one followed by the others.
The following is my approach for solving this request. A step by step guide:
1. Creating a view pane like the following:
In this view, the displays are created. We have two different ones. The selected one shows the finalists of the year, which is added via a contextual filter. The second one shows the winner.
The view will show winners or finalists for a given year based on the contextual filter configured. In order to use the view with panels, we created displays of type view pane. Note that in the pane settings, we specify the argument input to get the required context from panels. Thus the argument input is set up like this:
Later in step 3. When we add the displays to the panelizer, we will set the argument.
2. Panelize the taxonomy
In order to have these two views sorted by years, they will be attached to the “Year” taxonomy, to do this we need to panelize it.
The new view mode configured is displayed a bit wrong in panelizer for the taxonomy. So we have to go via Structure -> Taxonomy -> Year -> Panelizer -> list_winner_finalists.
3. Attach the winner and finalist view panes to the panelized taxonomy
After panelizing the taxonomy we can attach the before created view panes to it. As described, first winners and then the finalists. Use the top left gear icon, Add content and select view panes to choose from the defined view pane displays.
We have set the argument input in step 1 and now we need to select it here to provide the taxonomy terms as context to the view panes:
4. Creating a taxonomy view
Last step is to create a view which shows the taxonomy that uses the panelized viewmode and to sort this view by year.
5. Be very happy with the result:
We list all the years from most recent to earliest. And for every year we list the winner and multiple finalists.
The final result can be seen live here: https://www.resourceaward.org/winners-finalists