I have a content type called "Painting", this Painting includes a custom field pointing to a view (a "contextual view" in this case). I use this field to see all the Authors paintings.

If I want that the "contextual view" it's ok then I need to pass a parameter, the Author Id (it's contanined in the Node).

As a (node) example:
- Painting name: "MonaLisa" (text field)
- Author: "Da Vinci" (taxonomy term)
- paintings_by_author (View reference)
- 5 (View parameter. Let's suppose that "5" is the number assigned to my "Da Vinci" taxonomy term).

In this way, it works.

The problem is that I have to find out the taxonomy term for every term, and this info is already in the Node. And this is not a dynamic solution ;)

In order to pass the argument I can use PHP, then, I need to "recover" the actual node info and pass it as a parameter. In a really simplistic way I need something like:

  echo $actual_node->author_id.value;

Can anybody help me?

Thanks in advance.

Comments

NotGoddess’s picture

Unsure what you are using for the contextual view field, but it sounds like you are looking for a 'related content' view - pull in nodes matching your author term. You should be able to do this using a 'taxonomy terms on node' contextual filter - or you could look into the http://drupal.org/project/similarterms module.

I'm unique, just like everybody else.
If I helped, please pay it forward, backward or sidelong.

jplascencia’s picture

Really my "related content" view is working and it's ok. But I have to write "manually" the TID (or NID) for each "calling". I'd like to do it dynamically.

Suppose my url is something like this:
dondeconsigo.com.mx/paintings-from/da-vinci
or
dondeconsigo.com.mx/paintings-from/van-gogh

if Da Vinci has the TId = 12 and Van Gogh the TId = 245
then I have to go to each Node and write, as parameter, the number 12 or 245.

To avoid that problem I could (well, I think) get that value from my "actual node" and pass it as a parameter to my "related content" view.

Thanks for your answer.

ayesh’s picture

How did you add a View to the node?
I've had a great success with similar node listing using Entity Views Attach module.

jplascencia’s picture

http://drupal.org/project/viewreference

but let me check for your suggestion, does it "propagate" the arguments?

Thanks.

ayesh’s picture

EVA is not a 1:1 option for your module I guess. But you dont need to store the term ID separately. Full $node is available.

You will have to configure it using Views UI though.

However it seems like the module you are using do have $node object available.

Try $node->field_my_artist_taxonomy_term[0]['tid'].

If you install Devel module you can check the $node object.