Hi,

I have a custom type with an Integer field. I have a view to display that field. For whatever reason, when I try to access that field using the global php available fields, what gets returned is not the field value itself, but instead the node id.

What the heck??

Has this happened to anybody else?

Comments

nevets’s picture

What does your code look like?

jag339’s picture

Situation update...

Followed the advice given here: http://blog.cvrc.virginia.edu/?q=node/13.

Did a print_r($data);
Got a whole bunch of output.
The field I want output like this: [field_myfield] => Array ( [und] => Array ( [0] => Array ( [value] => 1 ) ) )

So I test it like this just to see what prints, but no value renders:

print_r($data->field_myfield['und'][0]['value']);
nevets’s picture

Try using print instead of print_r

jag339’s picture

Didn't work.

nevets’s picture

Looking at the project documentation I think you need to return (not print) the value

edrupal’s picture

The code you tried looks ok. Did you put it in the 'Value code' or 'Output code' field?

Whenever I've used Global PHP I can only access the $data variable if I put my code in the 'Output code' field

jag339’s picture

  print($data->_field_data['nid']['entity']->field_myfield['und'][0]['value']);

After analyzing the output of $data, I realized I needed to drill down -- WAY down -- the array stack.