Score:0

Using Views to list nodes that have the same field value as current node

se flag

I have a content type with has one particular field (among many other fields).

I need to create a block that will list all other items of that content type with the same field.

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

But I can't get to the contextual filter work for say field name: Publication

Under all combinations I haev tried, either everything appears. Or nothing does :/

Score:1
de flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.