Download & Extend

Display all nodes related to each term in the menu

Project:Taxonomy menu
Version:7.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

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

AttachmentSizeStatusTest resultOperations
taxonomy_menu.zip23.22 KBIgnored: Check issue status.NoneNone

Comments

#1

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

AttachmentSizeStatusTest resultOperations
taxonomy_menu.zip23.14 KBIgnored: Check issue status.NoneNone

#2

Thank you! Works great.

#3

#4

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.

AttachmentSizeStatusTest resultOperations
display_only_linked_nodes-1192084-1.patch5.69 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch display_only_linked_nodes-1192084-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#5

Status:needs review» needs work

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

#6

Hi,

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

Cheers

AttachmentSizeStatusTest resultOperations
display_only_linked_nodes-1192084-2.patch7.55 KBIdlePASSED: [[SimpleTest]]: [MySQL] 38 pass(es).View details | Re-test

#7

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

AttachmentSizeStatusTest resultOperations
taxonomy_menu.module.rej_.txt1.55 KBIgnored: Check issue status.NoneNone

#8

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.

#9

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 :)

#10

subscribe

#11

subscribe

#12

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

AttachmentSizeStatusTest resultOperations
display_only_linked_nodes-1192084-12.patch8.95 KBIdleFAILED: [[SimpleTest]]: [MySQL] 38 pass(es), 0 fail(s), and 2 exception(es).View details | Re-test

#13

subscribe

Edit: sorry, forgot about the new Follow button

#15

nvm

#17

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

AttachmentSizeStatusTest resultOperations
display_only_linked_nodes-1192084-1.patch8.95 KBIdleFAILED: [[SimpleTest]]: [MySQL] 38 pass(es), 0 fail(s), and 2 exception(es).View details | Re-test

#18

Status:needs work» needs review

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

AttachmentSizeStatusTest resultOperations
display_only_linked_nodes-1192084-1.patch8.95 KBIdleFAILED: [[SimpleTest]]: [MySQL] 38 pass(es), 0 fail(s), and 2 exception(es).View details | Re-test

#19

Status:needs review» needs work

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

#20

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
new-options-1192084-3.patch9.64 KBIdleFAILED: [[SimpleTest]]: [MySQL] 38 pass(es), 0 fail(s), and 2 exception(es).View details | Re-test

#21

Status:needs review» needs work

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

#22

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
new-options-1192084-4.patch10.21 KBIdleFAILED: [[SimpleTest]]: [MySQL] 38 pass(es), 0 fail(s), and 2 exception(es).View details | Re-test

#23

Status:needs review» needs work

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

#24

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
new-options-1192084-5.patch10.24 KBIdlePASSED: [[SimpleTest]]: [MySQL] 38 pass(es).View details | Re-test

#25

Tagging 'Needs tests'

#26

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

#27

#28

Status:needs review» reviewed & tested by the community

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

#29

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

#30

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

#31

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"

#32

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

#33

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

#34

Status:reviewed & tested by the community» fixed

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

AttachmentSizeStatusTest resultOperations
sync-menu-1192084-#34.patch9.44 KBIdleFAILED: [[SimpleTest]]: [MySQL] Fetch test patch: failed to retrieve [sync-menu-1192084-#34.patch] from [drupal.org].View details | Re-test

#35

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

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

#36

Status:fixed» needs work

#1350338: The Taxonomy Menu rebuild process encountered an error.

7.x-1.x is broken at the moment.

#37

Status:needs work» needs review

This patch should fix it.

AttachmentSizeStatusTest resultOperations
taxonomy_menu_undefined_method_fetchfield-1192084-1.patch588 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch taxonomy_menu_undefined_method_fetchfield-1192084-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#38

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.

#39

patch in #37 works

#40

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

#41

#37 works for me. Thanks.

#42

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!

#43

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?

#44

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?

#45

@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.)

#46

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

#47

Patch works, though the perfectionist in me wants to replace

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

with
<?php
  $temp
= $temp->fetchAssoc();
?>

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

#48

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.

#49

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.

#50

Status:active» fixed

Back to fixed.

#51

Status:fixed» closed (fixed)

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

#52

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 :)

#53

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.

#54

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

#55

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.

#56

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

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.

#57

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?

#58

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.

#59

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.

#60

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.