0

Let's say I have a custom entity that has two taxonomy reference fields: categories and tags. And I want to display all entities that have taxonomy term with id 1. The term is a dynamic value(contextual filter) so it can be either the category or tag.

How can I do that in Views? Right now I can filter categories or tags separately but I need to filter both of them.

If I use two filters they will cancel each other because each of them have, in my case, "Display contents of "No results found"" set.

  • How is this Drupal 8 specific? – tim.plunkett Mar 7 '14 at 7:24
  • 1
    in d7 there is filter for all taxonomy terms associated with a node. though I can'remember it's name, but it's in the core. – user21641 Mar 7 '14 at 16:55
  • Then it is in D8 as well, as all functionality was moved in. – tim.plunkett Mar 9 '14 at 23:45
  • Can you make a screenshot? I was not able to find it. I didn't even know it was in D7(since I haven't been using Views for a while) but someone mentioned it on irc so I've looked and it actually is in D7 Views. But not in D8(at leas I haven't found it). – user21641 Mar 10 '14 at 11:57
0

You can get an argument from url with views.

Use Provide default value in the contextual filter.

enter image description here

Another way (in drupal 7)would be to use this module: https://drupal.org/project/views_url_path_arguments

  • You didn't understood my question. I know how to use contextual filters. I'm asking how to use one argument for all taxonomy term reference fields an entity has. – user21641 Mar 3 '14 at 20:49
  • Ok, so use one argument for multiple filters? – dorien Mar 4 '14 at 12:24
  • I can't because if one field won't return results it will hide the whole View. – user21641 Apr 12 '14 at 18:08

Your Answer

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