Hi,

I have a vocabulary on which I want to use taxonomy menu, but I would like to have the ability to disable one or more terms from showing in the menu.
I have for instance france, southern-france, northern-france in the vocabulary. And I do not want to show france in the menu.
The term france holds terms so it is not good enough to disable empty terms.

Anyone please?

Thanks a lot in advance for your reply!
Greetings, Martijn

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dstol’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Status: Active » Postponed

Thanks for the suggestion. I'm marking this as postponed for the time being. A quick work around would be to display none the menu item's li. There should be a decent menu selector like menu-item-965.

suldan’s picture

When I disable a menu item in the menu module, it will automaticly be enabled on next cron or content submit (?) again.

Right now I can't disable selected menu items controlled by taxonomy menu (D 7.12 / Taxonomy Menu 1.2). I didn't try out the latest dev.

Baber Javed’s picture

I am facing the same issue. Disabling menu items works but the menu items start appearing again once we run cron or submit content for that category again

Barrett’s picture

Is this request any different from what is requested, and being worked on, in #1123152: Hide taxonomy term from menu (D6)?

johnv’s picture

Title: Ability to disable a term from the menu » Ability to disable a term from the menu & not re-enable after rebuild/sync (D7)

@Barrett, I think they are the same. But that's a D6 patch. Let's keep two separate versions?

@suldan, your problem describes a problem with the #1104028-94: Option 'Sync menu' in D7 , which got in as of April 19.
I'll quote #73 of that issue:
- set a taxonomy_menu to 'synced'
- set one of the menu-items to 'disabled' (via normal menu maintenance)
- change the taxonomy (add a term)
- the taxonomy_menu is has now 2 new items: the new one, and the disabled one is back enabled.

hles’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Postponed » Active
seanr’s picture

My solution to this problem was this:

/**
 * Fixes enabled issue on updating menu items.
 */
function example_taxonomy_menu_insert(&$item) {
  $item = _example_taxonomy_menu_item($item);
}

function example_taxonomy_menu_update(&$item) {
  $item = _example_taxonomy_menu_item($item);
}

function _example_taxonomy_menu_item($item) {
  $mlid = _taxonomy_menu_get_mlid($item['tid'], $item['vid']);
  if ($link = menu_link_load($mlid)) {
    $item['remove'] = $link['hidden'];
  }
  return $item;
}
johnv’s picture

Title: Ability to disable a term from the menu & not re-enable after rebuild/sync (D7) » Hide taxonomy term from menu & not re-enable after rebuild/sync (D7)

Better title.
This is the D6-version: #1123152: Hide taxonomy term from menu (D6)

johnv’s picture

Component: Code » Sync
MrPaulDriver’s picture

Issue summary: View changes

It would be good to have a solution for this, but I'm not a coder I am unsure how to apply the suggestion at #7.

My client has a commerce site with seasonal products which he'd like to hide from the menus at certain times of year, but for SEO reasons he'd like to retain the normal taxonomy listings.

Of course it be would be very simple to implement with css but a bit fiddly for my client.

Any suggestions would be most appreciated. Thanks

dieuwe’s picture

Title: Hide taxonomy term from menu & not re-enable after rebuild/sync (D7) » Hide taxonomy term from menu & do not re-enable after save/rebuild/sync (D7)
Component: Sync » Code
Category: Feature request » Bug report

I think this is a bug, not a feature request. Every time the term is saved, the "hidden" property of the menu is overwritten. This should not be the case. If someone has disabled a menu item it should stay like that until they enabled it again.

7.x-1.x-dev fix:

Replace L691 of taxonomy_menu.module

$link['hidden'] = (isset($item['remove']) && $item['remove']) ? 1 : 0;

With this:

$link['hidden'] = (isset($item['remove']) && $item['remove']) ? 1 : $link['hidden'];

7.x-2.0-alpha2 fix:

Replace L171 of taxonomy_menu.module

$menu_link['hidden'] = isset($is_hidden) ? $is_hidden : 0;

With this:

$menu_link['hidden'] = isset($is_hidden) ? $is_hidden :  $menu_link['hidden'];
dstol’s picture

Status: Active » Needs review
FileSize
524 bytes

Status: Needs review » Needs work

The last submitted patch, 12: 1426518-2.x-12-hidden-links.patch, failed testing.

dstol’s picture

Status: Needs work » Needs review
FileSize
532 bytes
gable’s picture

I've changed it to a more precise substitution:

$link['hidden'] = (isset($item['remove']) && $item['remove']) ? 1 : isset($link['hidden'])?$link['hidden']:0;

as the #14 patch caused errors for me while editing and saving a taxonomy term.

annya’s picture

gable pay attention that #14 patch is suitable for 7.x-2.x-dev version. I believe that you used 7.x-1.x-dev version.

annya’s picture

Status: Needs review » Reviewed & tested by the community

dstol patch #14 is great. I think we can commit it.

dstol’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

GEO’s picture

Version: 7.x-2.x-dev » 7.x-1.5
Status: Closed (fixed) » Needs review
FileSize
1.08 KB

Hi,
I've created patch for 7.x-1.5

rcodina’s picture

I tested patch #20 for version 7.x-1.5 and it works like a charm. Many thanks!

@dstol Was patch on #14 commited on 7.x-2.x-dev?

John Pitcairn’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Patch at #20 works for me with Taxonomy Menu 7.x-1.5 in Commerce Kickstart 2.

If the 7.x-2.x patch is in, status should be "to be ported"?

Summit’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Hi,
I think 1-x is the current function which is in production and development?
Than I think this patch should be put into RTBC?
Sorry if I am wrong, than please roll back.

greetings, Martijn

hanoii’s picture

I am current following up a request on something like this, I reviewed #20 which is nice little patch, but it will only work for menu items updates, not menu as that simply deletes all and then re-add.

hanoii’s picture

I just contributed Taxonomy menu extras.

It attempts to sort this out in a way that will work with reviews. I still think #20 is a good patch that's worth committing although it's not really necessary with this new module.The module attempts to sort other small change to the menu configuration that should be kept.

The module is overall simple and in a way, even simpler if its functionality is added to the module. If the maintainers are interested, I can attempt to submit the same functionality in a patch.

dstol’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

  • dstol committed 2b993e9 on 7.x-1.x authored by GEO
    Issue #1426518 by dstol, GEO: Hide taxonomy term from menu...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.