Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm adding a contextual filter to a view for a custom content type that has a taxonomy field. The contextual filter allows me to filter by the taxonomy tag id but not by the taxonomy tag name. Meaning with the given tags in the taxonomy:

1  | test1
2  | another tag
3  | taggy
......
99 | coolness

I can generate a contextual filter that will parse a URL like http://mydrupal/myview/3 to display all content that has been tagged with taggy BUT, the URL needs to pass the argument to lookup by tag name instead of tag id, e.g., http://mydrupal/myview/taggy to view all content tagged with taggy How can this be accomplished?

share|improve this question
add comment

1 Answer

up vote 76 down vote accepted

I assume you've added the Content: Has taxonomy term ID contextual filter. You can use taxonomy term names with this filter by adjusting Specify validation criteria settings. here's a screenshot:

Screenshot

Make sure Specify validation criteria is checked and you should be presented with more options. Under Validator choose Taxonomy term. You can optionally select with vocabularies to allow. Under Filter value type choose Term name converted to Term ID and check the Transform dashes in URL to spaces in term name filter values checkbox.

share|improve this answer
1  
Thanks! Can't believe I missed that option. –  powers1 Aug 16 '11 at 18:39
2  
in all honesty this isnt very intuitive for taxonomy terms. This answer helped me solve a week long problem. :) –  PhiloSurfer Aug 17 '11 at 20:49
    
brilliant! Thanks a lot for the detailed solution. I would have never figured that out on my own. –  MotoTribe Aug 24 '11 at 19:35
1  
This was a big help. Thanks. However, It appears if you are passing multiple taxonomy terms separated by + signs, it doesn't not work. Or rather, I think it's using and And instead of an Or. –  user2992 Sep 16 '11 at 18:34
4  
That's correct, + is interpreted as AND and , is interpreted as OR –  rocketeerbkw Sep 21 '11 at 0:56
show 1 more comment

protected by Community Feb 10 '12 at 12:19

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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