Drupal - Panels - Use NID Options

I use panels to replace the node template (node ​​/% node). I would like the system to use a specific option when loading node. For instance. node 123 should use option A, and node 223 should use option B. For me there is no way to determine that in the "Selection Rules" section I wonder if I should use PHP code, and if so, how should I write the code ?

I am aware of the possibility of using Node panels, but using it, there is no easy way to edit a node, which makes it less desirable.

+4
source share
2 answers

In this case, the simplest thing is probably to throw some kind of PHP code. It would be better to make an extension for the panel selection rules, but in this case it can be a bit crowded.

Anyway, something like

return arg(1) == 123; 

must do it.

Your problem is probably the Drupal / Panel cache. I just tested it and it works great.

+3
source

You will need to do something like this ...

  $nid = 11; if (arg(0) == 'node' && arg(1) == $nid && !arg(2)) { return true; } return false; 

Be careful only for testing arg (1), as in the previous answer, which will also correspond to users (user / 123), as well as any pageview that accepts a numeric argument (articles / 123).

+2
source

Source: https://habr.com/ru/post/1302745/


All Articles