0

I haven't had this problem in the past but I'm trying to retrieve a field value in a Views PHP Field for a view I made for Search API. I'm using the code below but I tried with 'nid' as well.

$stream = $data->_field_data['vid']['entity']->field_stream['und'][0]['value'];

You can see the var output here. I'm trying to get field_stream but am having no luck...

http://www.ovwrc.com/waste-search?search_api_views_fulltext=poop%20poop

1 Answer 1

0

Run $data though dmp to inspect the array and see what values are available.

Search Krumo may be useful as I expect that array will be huge!

5
  • As you can see here: pastebin.com/5dBtyYkL the entity field is blank. I'm starting to loose hair over not being able to print this field.
    – Ash
    Commented Mar 19, 2014 at 16:43
  • So if the field your after isn't in $data look else where. Not quite sure how your populating it but is there a different hook you can use?
    – Felix Eve
    Commented Mar 19, 2014 at 16:52
  • The field is there, you can see in the pastebin that it shows $field_stream and the correct value, but the entity is blank so I think that's why my code in the original question doesn't work. Is there another way to access that field.
    – Ash
    Commented Mar 19, 2014 at 16:54
  • I've got it working. I'm not sure how I missed this but I was sure I tried it: $row->$field_stream provided me the value. Thank you for your help!
    – Ash
    Commented Mar 20, 2014 at 13:22
  • Glad you got it working :)
    – Felix Eve
    Commented Mar 21, 2014 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.