Setting up the Variant - Setting the selection rules on the variant
When you have a number of variants, Panels will go through each one in order (from top to bottom) and check the selection rules. If that rule matches, then that variant is chosen and the page is laid out according to it. So you want to create a logical set of selection rules from the first variant to the last. In our case we want to check the following:-
- If the node type is 'Gallery' then use the first Gallery variant
- If the page type as defined in our taxonomy Page Type is 'blog' then use the Blog variant (second)
- If the node type is 'Web Form' (using the web form module), then use that variant (third)
- Otherwise as a catch all use the 'Standard Page' variant (fourth).
This is how we set up the Blog selection rules.
We go to the Blog variant and select the tab 'Selection rules'. We get this form.
Here we need to choose which selection rule to use from the drop down menu. If you click on it you'll see all sorts of options – like node type or taxonomy term. We select taxonomy and click add.We get a dialog box which pops up, allowing us to choose which vocabulary (Page Type) and what the term should be ('Blog').And when we save we see that selection rule listed. It can always be deleted (x) or changed (gear).So, in summary. When someone creates a new page and sets the 'Page type' to 'Blog' (done in the taxonomy section of the edit form), then this particular layout will be chosen.Panels works through the variants from top to bottom, looking at each selection in turn. This is like an 'if... else if' statement. So,
if (selection criteria from variant 1 is true) { display content from variant 1 }
else if (selection criteria from variant 2) { display content from 2 }
else { if there is a variant with no selection criteria, use this. If not, use normal Drupal page}