Hi all.

I have a weird issue with the custom PHP field. I have a view with 2 fields 'Email' which is a text field and 'Related directories' which is a node reference field. I've added a custom PHP field to run a few snippets of PHP, but I noticed thing weren't working as expected, so I did a var_dump on the result and found I was getting the following:

object(stdClass)#961 (6) {
  ["title"]=>
  string(14) "Quarry Manager"
  ["body"]=>
  string(5) "38457"
  ["field_job_email"]=>
  string(5) "38457"
  ["field_related_directories"]=>
  string(5) "38457"
  ["nothing"]=>
  NULL
  ["php"]=>
  NULL
}

Strangely, all values (aside from the title) seem to be getting replaced with the node ID and I can't figure out why. Has anyone ever experience this issue and if so is there a workaround?

The version of Views in: 7.x-3.3
The version of Views PHP is: 7.x-1.x-dev

Comments

jorditr’s picture

Yes, I'm having the same issue, all the fields are replaced with the NID using the same views and views_php versions (last ones).

jorditr’s picture

craigperks’s picture

Hi,

Thanks for the comment. Yeah, I'm aware that you can use the data object, but in my instance this really isn't feasible $row data is constructed in a certain way that I need and the raw $data output would require far too much messing about to make it a feasible option.

johnv’s picture

Component: Code » Field Handler
Issue summary: View changes
Status: Active » Closed (duplicate)