0

I have a content type "award" which have a taxonomy (product) as entity reference.

I want to add a contextual filter by term name on my view. I tried to use a contextual filter on "taxonomy term name" but it's not working, looks like i'm doing something wrong

I added the field in advanced > relations, that way i managed to make a working filter on the taxonomy term name i wanted, but i need a contextual filter

here is the view : enter image description here

here is the contextual filter configuration

enter image description here

1

The direct Product (which is a Taxonomy reference in your case) Contextual filter only works with term IDs, not their names. So you can make it work only if you choose the term ID in the validation settings.

To use the term name as the contextual filter you have to add the Relationship for the taxonomy reference field, which you seem to have done.

Now you can add the Term Name Contextual filter, from the Taxonomy term Category. (Remove the Contextual filter for the Product field that you currently have.) You didn't have the Term Name available under Contextuals before you added the Relationship. That Contextual will use the Relationship automatically.

When you add the Term Name contextual you will be able to set up the term name Validation, and you'll need to enter the term names in path arguments and in Views Preview field to test it.

1
  • Detailed and concise answer, followed step by step and it's working like a charm.At first i hadn't the term name contextual filter, but it was because i was on Drupal 8.2 . After updating core no more problems – SupFrig Jul 30 '20 at 14:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.