I have spent several hours digging into the panels and ctools code trying to figure how to accomplish this on the panels side of things to no avail.

In a nutshell I need to be able to have a node page use the variant of its parent node as defined by the menu tree.

so basically

if (this_variant == my_node's_parent_menu_item_variant) return true;

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

You're going to have to use the PHP Code selection rule and write code to do that. I don't know how to write that code, unfortunately.

stefan freudenberg’s picture

Is it currently possible to create plugins for that? I have a completely different use case but I wonder if there's a way to handle that logic in a plugin rather than putting code into the database.

cangeceiro’s picture

yes it is, i ended up implementing my scenario this way. look in the ctools folder for example plugins.

briandorval2’s picture

Anyone have any example how to use the Code PHP in the Selection Rules, I need to get the userid (uid) and the nodeid (nid).
We probably can get it from the $contexts but I can't find it.

Thanks in advance.

briandorval2’s picture

That's OK, I found a way to did it:

global $user;
$node = node_load((arg(0) == 'node' && is_numeric(arg(1)))?arg(1):FALSE);