0

I have a content type App with a term reference field called App category.

I'm creating a view page with path app/%. I don't want to use App ID or anything numeric in URL in place of %, so I'll be using app/cooking-app where cooking-app is URL Alias of App Category.

How can I display all the nodes whose value in App Category field is cooking-app? I can easily do this using PHP code but PHP code in contextual filters is not working.

2

I'd highly recommend not using PHP code to do this; tying PHP code to configuration can be error-prone and it won't exist in Drupal 8's Views.

Rather, you can use the solution in Drupal 7 views contextual filters taxonomy name where you can use the Validator, Taxonomy Term, instead of PHP Code, with the Term name converted to Term ID filter.

  • Thanks Shawn, The solution on the link provided worked like a charm. Thanks. – Mohit Wadhwa May 18 '16 at 5:54

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.