Show Active terms from vocabulary using taxonomy menu

What i want: Active terms of vocabulary in main menu.

What i have done so far:

  1. I have used taxonomy_menu module.
  2. Created taxonomy(Category).
  3. Added "Status" field having boolean values (0 = Inactive, 1 = Active).
  4. Added two terms in Category(Cat1 and Cat2).
  5. Cat1 = Active, Cat2 = Inactive.
  6. 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.

Answers


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.


Need Your Help

Installing libssh2

php ssh

Does anyone know how to install libssh2 into php on a windows environment?

Want to echo specific value from json data

php

{"data":{"tokenId":"cbad508f88a2a8ff47c75426338026de"},"success":true,"error":{"errorCode":"200","errorMsg":"successfully"}}