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?

link|improve this question
feedback

1 Answer

up vote 19 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.

link|improve this answer
Thanks! Can't believe I missed that option. – powers1 Aug 16 '11 at 18:39
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
1  
That's correct, + is interpreted as AND and , is interpreted as OR – rocketeerbkw Sep 21 '11 at 0:56
feedback

protected by Community Feb 10 at 12:19

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

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