I'm trying to use a panel for showing some more fields based on which value has a radio button in this node. I have a radio button with four numeric values 1, 2, 3, 4.
The goal is if I select number 1 - I can see only the base part of the node - title and body. If I select number 2, then I can see title, body, and a picture, and so on.
So I have setup a panel, with Node type selection rule I filtered the content type and now I'm trying to figure out, how to make the variants using the values from radio button.

I tryed this code, which work well, when I tested it directly in the node with selected PHP input format. But when I put it in selection rules PHP CODE I got only "page not found".

 if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
  $node = node_load(arg(1)); // I got the nid of the node
$node->field_catalogue_type[0]['value']; // I got the checked value of the radio button
$result = $node->field_catalogue_type[0]['value'] - 1; // I substract number one from the value
$result == 0; // If this equation returns true I should pass the selection rules
}; 

I'm not a programer, doing this few lines of code took me 8 hours of thinking, googlink and trying many ways. So probably does exist a much easier way to fullfill my goal.
Can anyone correct this?

Comments

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Did you put this in a selection rule where the URL is not node/NID ?

BarisW’s picture

bighead,

as far as I can see you forgot to return the value.
Try the last line as:
return $result == 0;

esmerel’s picture

Status: Postponed (maintainer needs more info) » Fixed

Suggestion made, no updates for more than 30 days.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.