0

I have a content type with a field. I need to create a block that lists all the nodes with the same value for that field.

Doing this for related taxonomy terms is easy: Contextual Filter > Taxonomy term ID > Taxonomy term ID from URL > Limit terms by vocabulary > Vocabulary.

I cannot make to the contextual filter work for that field. Under all combinations I tried, either everything appears or nothing does.

1 Answer 1

1

Views Token Argument is the module you are looking for. It allows you to use Tokens in your contextual filters fixed values.

Here is what to do to have your View working:

  1. Set a contextual filter on your field (let's say Publication with machine name "field_publication") and under the section "When the filter value is not available", select Provide a default value and choose Token from the select list. Now, you need to fill the Token textfield with the token name (e.g. [node:field_publication]). Save your filter. Token contextual filter
  2. Add a second contextual filter on "Content: ID", select Provide default value and Content ID from URL and under the "More" section, check the Exclude box to have the view return all matching nodes but the current one. Save your filter and your view.
  3. Set your block display and you're done.

PS: Maybe it is unrelated but when using this "Token" option, the View preview does not work anymore for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.