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
Comment #1
jorditr commentedYes, I'm having the same issue, all the fields are replaced with the NID using the same views and views_php versions (last ones).
Comment #2
jorditr commentedIt looks it's been discussed here: #1516348: How to call the value of field within a node so that Views PHP can do its magic.
Comment #3
craigperks commentedHi,
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.
Comment #4
johnvSee also #1140896: Variable $row does not contain correct values ($data->_field_data does)