1

I have a node type 'XY' with a reference to a taxonomy vocabular 'country'. Also I have a reference to this vocabular in file entities.

I have a view with an EVA display. This EVA field is attached to the node type 'XY'. This view displays file entities. These entities should be filtered by the taxonomy term of the attaching node.

When a node has the taxonomy term 'America', all file entities with taxonomy term 'America' as well should be displayed in the view (and in the node via the EVA field).

Without any filter it works with displaying all file entities.

I set a contextual filter File:

Country (field_file_image_country), Provide default value->Field value from current node/term->field_gallery_country (the taxonomy reference in node type)->TID

Specify validation criteria->Taxonomy Term->Vocabular 'Country'->Filter value type 'Term ID'

But it doesn't work. Nothing's displaying.

2
  • No one with any idea? The EVA field could also be a block.
    – deelite
    Commented Jun 16, 2015 at 11:30
  • I don't understand quite how you're providing the default value for your Contextual Filter. Are you setting it via the configuration for the contextual filter itself (in the 3rd column of the Views interface) or are you configuring it in the EVA-specific "arguments" configuration in the middle (2nd) column of the Views interface?
    – Aaron
    Commented Aug 11, 2015 at 3:41

1 Answer 1

1

I have a similar case of two Content types that share the same Taxonomy vocabulary referenced, and the need to show all nodes of Content type B that are tagged with a certain term to show on the node type A that is also tagged with the same term.

I created EVA views display that lists nodes of type B, under Bundles chose Content type A, under Arguments chose token (Use tokens from the entity the view is attached to) and chose

[node:field-myvocabulary:tid]

for token replacement (I selected it from the list below the textfield).

Then under Contextual filters I added

Content: Has taxonomy term ID

and set it up like this:

When the filter value is NOT available

  • Provide default value Taxonomy term ID from URL
  • Load default filter from term page
  • Load default filter from node page, that's good for related taxonomy blocks
  • Limit terms by vocabulary (myvocabulary)
  • Filter to items that share any term

When the filter value IS available or a default is provided

  • Specify validation criteria
  • Taxonomy term:
    (myvocabulary)
  • Filter value type: Term ID
  • Transform dashes in URL to spaces in term name filter values
  • Action to take if filter value does not validate: Display "Access denied" (this hasn't been triggered for me)
1
  • 1
    Thanks this answer pointed me in the right direction. However using Drupal 8 I found that the token needed to be [node:field_myvocabulary:target_id].
    – AdamS
    Commented Feb 18, 2020 at 10:10

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.