Show Active terms from vocabulary using taxonomy menu
What i want: Active terms of vocabulary in main menu.
What i have done so far:
- I have used taxonomy_menu module.
- Created taxonomy(Category).
- Added "Status" field having boolean values (0 = Inactive, 1 = Active).
- Added two terms in Category(Cat1 and Cat2).
- Cat1 = Active, Cat2 = Inactive.
- Configured menu from "Edit vocabulary" section.
Problem: All terms of vocabulary are included in main menu. I want that only those terms whose Status = Active should be displayed in main menu.
The process to make taxonomy_menu module aware of your status field seems hard to accomplish, particularly if you need - as you probably would - the taxonomy menu rebuilt when a status value changes.
A possibly easier solution would be to act at the theme level, adding a .inactive class to inactive items and make it hidden in css. Since Taxonomy Menu module does nothing about themeing, this should be dealt with with Menu module theme functions. So you'll end up writing a (e.g.) CUSTOM_menu_link() function in which you'll need to test if the link is coming from a taxonomy generated menu (not sure how you can do that, anyway) for every menu item of your site and then, if this is the case, load the term, test the status field and act accordingly. Not exactly an elegant solution, and quite an overhead.
If possible, I'd rather suggest you use the built-in feature to enable or disable menu items from the admin interface at admin/structure/menu/manage/main-menu, after configuring your taxonomy-menu.
Try this module: https://www.drupal.org/project/termstatus
This module adds a status-flag to taxonomy terms. Using this flag it is possible to specify whether terms should be published or not. Users with the appropriate permission may access unpublished terms.