How do I return the value of a node reference field via PHP code in a view contextual filter?

I am attempting to do so via the following steps:

  • Adding the node reference field in the contextual filters area
  • Selecting "PHP Code" under "Provide default value"

I get stuck here because none of the data items provided by the Views module ($view and $argument) give access to the data saved in the node reference field.

In Drupal 6, the Views module gives access to a $data variable which contains CCK data saved in nodes, but it seems there is nothing like that in Drupal 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.