Hi,
I worked a bit on the dev version to add 3 new options:
1) To be able "not to" expand the menu by default (it seems the variable already existed but not configurable)
2) To be able to display only terms linked to nodes (I didn't specify which content types, but very easy to add this option)
3) To be able to display all nodes related to each term in the menu

As I'm a nerd with Git, I send you the whole zip. For those interested, changes has been made only in taxonomy_menu_form_alter(), taxonomy_menu_vocab_submit() and taxonomy_menu_handler() of taxonomy_menu.module

Cheers

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lahode’s picture

FileSize
23.14 KB

Hi,

After checking all my work of last Friday, I discovered there was already an function "_taxonomy_menu_term_count" for the functionality "To be able to display only terms linked to nodes"

So I fixed it and changed my code.

I still have 2 issues:

1) When changing the name of a term, it doesn't change it in the menu
2) If I delete a node or change the category, it stays at the same position in the menu.

However, globally it works well

Cheers

dreamdust’s picture

Thank you! Works great.

dstol’s picture

lahode’s picture

Hi,

The zip was done with a previous version of taxonomy_menu, I quickly checked the diff with the last version and created a patch. I didn't have time to test it, but it should work.

Status: Needs review » Needs work

The last submitted patch, display_only_linked_nodes-1192084-1.patch, failed testing.

lahode’s picture

Hi,

I was made it too fast last time. Try this one it worked for me.

Cheers

waynedpj’s picture

thanks for the patch. i have been looking for a way to add menu items for nodes under each term https://drupal.org/node/1293538

since that was one of your added features i tried to apply the patch to Taxonomy Menu 7.x-1.2 but received the following:

$ patch -b < display_only_linked_nodes-1192084-2.patch 
patching file taxonomy_menu.database.inc
patching file taxonomy_menu.module
Hunk #3 FAILED at 457.
Hunk #4 succeeded at 545 (offset 1 line).
Hunk #6 FAILED at 626.
Hunk #7 succeeded at 862 (offset 1 line).
Hunk #8 succeeded at 884 with fuzz 2.
Hunk #9 succeeded at 903 with fuzz 1 (offset 1 line).
2 out of 9 hunks FAILED -- saving rejects to file taxonomy_menu.module.rej

the rejection file is attached.

however, both the expand option and children nodes are now working. it is safe to continue to use this patch if it did not totally apply cleanly?

regardless, thanks for the help. i will be happy to test additional patches for you.

peace

waynedpj’s picture

i just realized that my problems in https://drupal.org/comment/reply/1192084/5049792#comment-5049792 were due to me not patching against the 7.x-1.x-dev version, instead of the 7.x-1.2 version which i had done. the patch does apply cleanly and seems to be working here with Drupal 7.8.

thanks again.

groovehunter’s picture

the patch from #6 worked for me against current 1.x-dev : adding nodes as childs is fine, expand / not expand is fine, but hiding terms without nodes not yet.

thanks and keep up the good work - Showing number of nodes in brackets would be next on my wishlist :)

calculus’s picture

subscribe

ranx’s picture

subscribe

lahode’s picture

Hi again,

Please don't suscribe my previous patch, it was dirty work. Today I completely reviewed the changes and it should be better to submit this one.

Please check before if something fail

Cheers

rp7’s picture

subscribe

Edit: sorry, forgot about the new Follow button

rp7’s picture

nvm

firebird’s picture

Lahode: Looks like the bots didn't grab your latest patches for testing. Maybe a file naming issue?

firebird’s picture

Status: Needs work » Needs review
FileSize
8.95 KB

Or is it that no-one remembered to set the status to "needs review"?

Status: Needs review » Needs work

The last submitted patch, display_only_linked_nodes-1192084-1.patch, failed testing.

firebird’s picture

Status: Needs work » Needs review
FileSize
9.64 KB

Status: Needs review » Needs work

The last submitted patch, new-options-1192084-3.patch, failed testing.

firebird’s picture

Status: Needs work » Needs review
FileSize
10.21 KB

Status: Needs review » Needs work

The last submitted patch, new-options-1192084-4.patch, failed testing.

firebird’s picture

Status: Needs work » Needs review
FileSize
10.24 KB
dstol’s picture

Issue tags: +Needs tests

Tagging 'Needs tests'

johnv’s picture

I am anxious to test this, but havent done it - was busy with the other issues..

dstol’s picture

Summit’s picture

Hi, Will this be committed please? They are much wanted features and patches #24 is working.
Greetings, Martijn

lahode’s picture

Status: Needs review » Reviewed & tested by the community

Hi, I tested #24 and works fine. Don't use #6 it was the first test

Summit’s picture

Hi, Patch #24 is working, that the options arise. I hoped I got the possibility to have a menu on which:
1) I am able to set say the first two levels expanded:

- Europe    <=== Homepage situation at start, 2 levels expanded.
---France
---Austria
---Germany
etc..

1) When I click on a above level, the underneath levels are getting expanded:

-Europe
---France  <===== Click on France
-----Paris
-----Lyon
etc..

But I can't get this to work.. Could you help with this please?
Thanks a lot in advance!
Greetings, Martijn

johnv’s picture

Hi Martijn,
auto-expanding seems to be a problem with core.
Check for "Auto expand" in the core issue queue,
There are also some module regarding "Menu trail"

Summit’s picture

Hi,
@Johnv Did you solve this? I tried Taxonomy_menu_trail but it wouldn;t work...
Thanks a lot in advance!
Greetings, Martijn

johnv’s picture

No, I just set my menu to 'Expanded'...

dstol’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests
FileSize
9.44 KB

This still needs tests but I committed it to 7.x-1.x. Check out the attached patch for what I committed, since it's a little different. http://drupalcode.org/project/taxonomy_menu.git/commit/09e7d88

firebird’s picture

The hash in the filename breaks the URL. Try this:

http://drupal.org/files/sync-menu-1192084-%2334.patch

dstol’s picture

Status: Fixed » Needs work
firebird’s picture

Status: Needs work » Needs review
FileSize
588 bytes

This patch should fix it.

kiwimind’s picture

I have applied the patch at #37 manually and it works fine.
I'm not sure whether to drop this in here, or whether it's even doable, but is it possible to have the menu item display order mirror the taxonomy listing order?
Edit: Further to this, they do obey the weights as given in the taxonomy list when the taxonomy menu is rebuilt, but not when reordering them in the taxonomy terms list.

ali_b’s picture

patch in #37 works

Summit’s picture

Status: Needs review » Reviewed & tested by the community

Hi, Patch in #37 works, please commit, because the latest .dev version is not working now.
Thanks in advance,
greetings, Martijn

mrfelton’s picture

#37 works for me. Thanks.

m0d’s picture

Hi!

I patched 7.x-1.x version with #37, but it looks like the "Add all linked nodes to each terms" feature isn't there anymore. Did I do it right? How can I have that feature? I find it very important.

Thanks!

jeffschuler’s picture

Status: Reviewed & tested by the community » Active

It looks like the show_nodes option (the "Add all linked nodes to each terms" feature) was removed between the patches in #6 and #12, and never made it into the commit (in #34.)

@lahode: was this intentional?

lahode’s picture

Hi,

Yes it was.

First I was looking for a way to display all the nodes as children of each terms. But then, I first found that my coding was not working not working so well and that it wasn't a great idea to mix the concept of taxonomy and nodes into the same menu, so I finally decided to use views.

I leave it to you to decide whether this feature is interesting or not and if yes, maybe to adapt it to #37

By the way I didn't test last dev, did Dstol add the patch to the release?

jeffschuler’s picture

@lahode: Thanks for your response. I figured as much, considering that [the now abandond] Taxonomy Treemenu module requires >200kb of code to accomplish this. You put views underneath taxonomy menu terms? Contrib modules or custom implementation?

Yes, dstol committed the patch to 7.x-1.x-dev. See #34. (#37 is a fix post-commit.)

lahode’s picture

No, I wasn't clear.

In fact I simply display the nodes related with a View when the term is selected, no relation with this module.

However I wonder why you would need 200kb of code to add this option? In fact to find all nodes to a term is very easy, see: @@ -517,7 +544,38 @@ function taxonomy_menu_handler($op, $args = array(), $node = NULL, $item = array in patch #6.

Then the only thing to do is to manage when creating, updating or deleting a node the modification in the tree with a ook_node_insert($node), hook_node_update($node) and hook_node_delete($node). Regenerating the tree each time would be a 1 line option, while it might be a bit dirty and slow the entire Drupal.

As far as I use this module today, it is nothing more with the latest dev + #37 as mentioned

kingandy’s picture

Patch works, though the perfectionist in me wants to replace

  $temp = $temp->fetchAllAssoc('term_count');
  $temp = reset($temp);

with

  $temp = $temp->fetchAssoc();

The return $temp->term_count on the next line functions exactly the same, and it's a line less of code ...

patoshi’s picture

im getting this:

screenshot: http://prntscr.com/4btca

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=22&op=do StatusText: OK ResponseText: Fatal error:

Using D7.9 and comes up after i link a taxo to a menu.

dstol’s picture

I just committed #37, with the tweak from #47 and I removed a notice that it would be throwing otherwise.

http://drupalcode.org/project/taxonomy_menu.git/commitdiff/632adcd

Please test.

dstol’s picture

Status: Active » Fixed

Back to fixed.

Status: Fixed » Closed (fixed)

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

hmartens’s picture

I noted this comment at discussion(http://drupal.org/documentation/modules/taxonomy_menu#comment-5563868) as well (sorry)...

I used the "7.x-1.2" version on Drupal 7.12 but it doesn't give me the options for expand menu etc. So I installed the "7.x-1.x-dev" version that gives me the options but still doesn't help me at all. There's no difference whether I use "Auto expand menu items" or not...and the "Add item for vocabulary" is great out, I can't select this option... and I can't add anything in "Custom name for vocabulary item"...

Maybe I'm missing something because I can't get it displaying right...I want a menu item called "Category" which is my taxonomy term and then when I press that it drops down a menu with all the terms listed under Category...

Please help..and thank you :)

jeffschuler’s picture

hmartens: see #45 here. The ability to list nodes in the menu was initially part of the patch here, but was removed and has not been added to this module.

hmartens’s picture

aah shucks! So I'm a bit screwed then :) Thanks for replying though

dubcanada’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Needs work

I don't know why this was closed considering only half of what was positioned has been added.

hles’s picture

Title: New options with nodes and expand - D7 version » New options with nodes and expand
Category: support » feature

If we are going to commit new features in 7.x-2.x, we are going to need tests shipped with them. Maybe it would help to create 3 separate issues, one for each feature.

firebird’s picture

So, to get this into 7.x-2.x, we'd need to add the functionality from #34 and #37, and add tests for them, right?

hles’s picture

Always with tests yes. Maybe we should be careful not to add any feature, just the ones that are common use cases, else I worry we will have a very bloated admin interface. But that's up to discussion.

firebird’s picture

Ah. but 1) from the original post has already been implemented in 7.x.-2x. I didn't realize that. That's actually the one that I need, so I'll leave 2) and 3) to someone else.

hles’s picture

Title: New options with nodes and expand » Display all nodes related to each term in the menu

Even 2) is implemented as well in 2.x as far as I understand what it means. I'll change the title to focus on 3) only, although I'm not really keen in adding this feature.

johnv’s picture

Title: Display all nodes related to each term in the menu » New options with nodes and expand
Status: Needs work » Fixed

This thread is getting very long and complex. It contains 3 issues, of which 2 are fixed.
let's close this thread, and open a follow-up here: #2004266: Display all nodes related to each term in the menu

Status: Fixed » Closed (fixed)

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