Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
Thanks for a great module.
One problem though. If you have a multilingual view for example, and you have a menu for all the languges of the site, and you reference the view through multiple menu items, the Menu Block just shows on one of these pages. The Menu block does not seem to be able to handle multiple menu items pointing to the same destination.
Comment | File | Size | Author |
---|---|---|---|
#36 | menu_block_dup_paths-618700-36.patch | 1.81 KB | C. Lee |
#28 | menu-block-618700-28.patch | 1.7 KB | dealancer |
#17 | menu-block-dupe-menu-links-618700-17.patch | 1.83 KB | JohnAlbin |
Issue fork menu_block-618700
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
DrupalNovice CreditAttribution: DrupalNovice commentedComment #2
stoltoguzzi CreditAttribution: stoltoguzzi commentedthe same here!
Comment #3
ressa CreditAttribution: ressa commentedYes, the menu block disappears when on a view page, except for the default language.
The block is shown on this page:
/references/pictures
but no on this:
/fr/references/pictures
Comment #4
ressa CreditAttribution: ressa commentedI ditched the page views, since their paths caused the problem, and now only use blocks, displaying them in the content area: http://drupal.org/node/130389#comment-2362658
Comment #5
DomoSapiens CreditAttribution: DomoSapiens commentedSame problem here!
I have two menu items (English and Dutch) to a vocabulary index called "tags".
On the English page the menu block dissappears when i'm on the vocabulary index page.
The block is visible on /tags
It's invissible on en/tags
Comment #6
mlncn CreditAttribution: mlncn commentedProblem for other menu items, to give an example that's not multilingual related.
benjamin, agaric
Comment #7
mlncn CreditAttribution: mlncn commentedThere are two parts of menu_block that seem to fail
The harder to fix is menu_tree_add_active_path() which cuts out -- stops looking and deletes other branches of the tree -- when it finds the first active menu item. It short-circuits Drupal's usual behavior of allowing multiple active paths in one tree and only allows one.
Comment #8
FiNeX CreditAttribution: FiNeX commentedThis problem is a big problem... someone can suggest a workaround?
Comment #9
ressa CreditAttribution: ressa commentedHave you looked at the approach referred to in post #4? - http://drupal.org/node/130389#comment-2362658
Comment #10
FiNeX CreditAttribution: FiNeX commentedI didn't really understand it :-(
Comment #11
FiNeX CreditAttribution: FiNeX commentedAfter some testing I've tried this solution which partially works:
Primary links
- menu 1 (en)
- - sub menu 1.1 (en)
- - sub menu 1.2 (en)
- - sub menu 1.3 (menu created by the views module)
- menu 2 (it)
- - sub menu 2.1 (it)
- - sub menu 2.2 (it)
- - sub menu 2.3 (menu manually created which links the views path)
1, 1.1, 1.2, 2, 2.1 and 2.2 are menu which links a node page. menu 1 links to the english version of menu 2 (which is the italian one).
sub menu 1.3 and sub menu 2.3 links a view which displays all story nodes with the current language.
The default language is "it". When I visit the sub menu 2.3, the menu_block is visible: it correctly display sub menu 2.1, 2.2 and 2.3. If I switch (with the languageblock switcher) to the english version, the views correctly loads, but the menu_block is not displayed anymore.
I hope to have well explained my situation and I really hope to find a solution to solve this issue :-(
Thanks in advance to everyone!
Comment #12
FiNeX CreditAttribution: FiNeX commentedI've done an extra test: I've enabled the "menu breadcrumb" module so I can check the "trail".
When I click on "sub menu 1.3" the breadcrumb is:
* Home > sub menu 1.3
When I click on "sub menu 2.3" the breadcrumb is:
* Home > menu 1 > sub menu 1.3
It looks like only the menu I've manually addedd knows how is his father :-(
Comment #13
FiNeX CreditAttribution: FiNeX commentedThis problem looks similar: http://drupal.org/node/400748
Comment #14
ressa CreditAttribution: ressa commentedIt's pretty straightforward though, just use a Views Block, not a Views Page:
1. Make a Views Block, with the same content as the Views Page you are trying to fix.
2. Make a normal Page (not Views), note down the path and put it where you originally wanted you Views Page. You will put the Views Block after the content of this page.
3. Under the Block settings (admin/build/block), specify it to be shown ONLY on that path you copied under content.
4. Now you have a normal menu item, from the page, and therefore a menu block AND the breadcrumb also works...
Ask if it still isn't clear!
Comment #15
FiNeX CreditAttribution: FiNeX commented#14: I know that way, it was my first thought... unfortunatly the website structure is very complex with hundred of pages; sub menus should be putted on lot of them, so you have to edit the block settings for each new page you add... trust me, in this case it is not a solution :-(
I've found a different solution. I've configured the primary links i18n_variable and now there are two primary links, one for each language. Subsequently I've added a second menu_block. Now I've two menu blocks, one for each menu, so there is one for each language... and it works: the menu doesn't seems disappear anymore (in fact there are two menus, and only one is visible) :-) :-)
So we can consider that the specific case when two links points to a view and we're on a webiste which uses i18n (and the two links are the localized links) can be solved with the described procedure or with the #14 trick.
Anyway both of them aren't the real solution of the initial problem but only workarounds for specific situations.
At least I've solved my specific problem for the menu block, not yet for the menu_breadcrumb (http://drupal.org/node/400748)... but I'll solve it either. Thanks ressa for answering me :-)
Bye
Comment #16
ressa CreditAttribution: ressa commentedYou're welcome 8o)
Nice workaround you thought out, you probably did what this guy explains here, right? http://drupal-translation.com/content/managing-translated-menus ...that solution is better for a complex site, I agree.
For now I will stick to the other workaround, since it has these benefits:
- No need to set URL aliases
- Meta tags for all languages
- Easier for the editor, since everything now is pages, in stead of a mixture of normal pages and page views, which have to be translated in different ways.
- Less need for custom_breadcrumbs, since large parts of the paths are now ordinary menu paths, and can be generated with menu_breadcrumb
Comment #17
JohnAlbinI spent some time looking at this and I think this is a core bug. I'm pulling the active trail data directly from menu_tree_page_data().
I also compared a menu_block for the primary links menu with a standard core "primary links" block and they show the exact same behavior. If two or more menu links point to the same path, only one of them gets recognized as being in the active trail. Can you guys confirm that core menu's blocks work the same as menu_block's blocks?
I even tried the attached patch, but it didn't seem to help any.
Comment #18
BarisW CreditAttribution: BarisW commentedSubscribing. Same problem with for example the FAQ module and two languages. www.site.com/faq works, en.site.com/faq doesn't. I agre with John that this is a core issue, but it would be great if Menu Block could hack a way around this bug :)
Comment #19
emdalton CreditAttribution: emdalton commentedWe just started having this problem with the latest update (6.x-2.3). Prior to that (6.x-2.2) we were able to have multiple menu blocks appear on the same page if that page appeared in all the menus. In our case, we aren't using multilingual pages, we just have several pages that need to appear in more than one menu. I didn't change Drupal Core at the same time-- in both situations we were using D6.16. Please let me know how I can help troubleshoot this problem.
Comment #20
bedlamsubscribe
Comment #21
manmohandream CreditAttribution: manmohandream commentedI am facing somewhat different issue.two menu items on primary link points to same link but the argument passed is different.Due to this both links become active whenever anyone of two is clicked.
Any solution for this.
Thanks
Comment #22
tobiberlinsubscribe. The same issue here when I point with two items to one view on a multilingual page where the first item links to this view with an English label and the second with a German label. It seems that the second items causes the problem although German is the default language (regarded to some ideas above). So if I click on the second item OR I change the language while showing the view in English, the menu block disappears.
# Edit #
I looked at http://drupal.org/node/398888#comment-2388722 but for me this is not the problem. My menu has the structure
- Parent item 1
- sub item 1
- sub item 2
- Parent item 2
- sub item 1
- sub item 2
Where Parent item always links to the same node (!) as its sub item 1 - both items are shown correctly as active and the menu block is still shown. The first item block or parent item 1 is just shown when the language is English, the second when the language is German. Now the first sub item 2 (of parent item 1) and the second sub item 2 (of parent item 2) link to the same view labelled with their language. If I click on first sub item 2 the view is shown correctly in English. when I change the language or I click on the second sub item 2 of parent item 2 the menu block disappears.
Comment #23
jmseigneur CreditAttribution: jmseigneur commentedSubscribing
Comment #24
isaachorton CreditAttribution: isaachorton commentedim having this issue as well.
Using the domain access module and multiple menu block items pointing to the same node.
The Menu Block will not show!
Solution anyone?
This is turning into a major issue for me.
Comment #25
isaachorton CreditAttribution: isaachorton commentedUpdate:
Using the node symlinks module does NOT fix this problem
Before I was adding the alias to menus that points to the same destination, but here you add it via the node.
http://drupal.org/project/nodesymlinks
Comment #26
dealancer CreditAttribution: dealancer commentedsubscribing, but solution #25 doesn't work for me
Comment #27
dealancer CreditAttribution: dealancer commentedIt seems the problem in menu_tree_page_data - it does not return full tree.
Me menu structure
Primary links:
-About (en)
-- Contact (en)
-- Page 1 (en)
-- Views (en)
-- Page 2 (en)
-About (de)
-- Contact (de)
-- Page 1 (de)
-- Views (de)
-- Page 2 (de)
While wieing the Page 1 or Page 2 Menu Block is shown. When viewing Contact(de) or Views (de) it not happens. If I delete from menu Contact (en) and Views (en) then it will be shown on those pages.
Comment #28
dealancer CreditAttribution: dealancer commentedThis bugs happens with everything which has the same path expect a nodes. Menu block uses menu_tree_page_data(...) to build a trail to the node.
For the menu_tree_page_data(...) there is no difference between 'contact' and 'de/contact' because it is pointing at he same page 'contact'. It returns only the first occurrence of that path from the table (In my case this is English menu) and build active trail to the page. Hence we've got trail to the 'conact' but not for 'de/contact', so this trail will be cut of by Menu Block module as improper.
The only working way I've found is to patch menu_tree_page_data (...), which is located in /included/menu.inc. My patch is attached.
Comment #29
dealancer CreditAttribution: dealancer commentedprobably i11nmenu should provide similar and patched function and it should be used in Menu Block and others module.
Comment #30
jmseigneur CreditAttribution: jmseigneur commented#28 patch does not seem to work on my side. Works in default language but not in other languages. Menu Block appears in default language but not in other languages.
Comment #31
dealancer CreditAttribution: dealancer commentedjmseigneur,
Have you tries to clear cache?
What is you menu structure?
Comment #32
jmseigneur CreditAttribution: jmseigneur commentedYes the cache has been cleared without effect. The primary-links is used as the main menu. In this menu there are links in French the default language and English. A Menu Block is linked to this menu, displays the sub-menu items of the selected item of the main menu in French, the sub-menu items in English do not appear even after your patch.
Comment #33
dealancer CreditAttribution: dealancer commentedjmseigneur, If the parent menu is French, it won't display English sub-items, even if the current menu is English. Try to set parent menu language-neutral, or use menu structure as in #27/
Comment #34
askibinski CreditAttribution: askibinski commentedCheck out this related core issue: #609542: Active trail isn't set on all menu items pointing to the current path and patch at #12 which I believe might also fix this problem. (though it is a core patch for a core bug).
Comment #35
stockliasteroid CreditAttribution: stockliasteroid commentedI applied the patch mentioned in #34. While active-trail is now correctly set on the multiple menu items that the node is linked to under, the menu block still doesn't work correctly... I'm going to continue to look into this.
Comment #36
C. Lee CreditAttribution: C. Lee commentedHere's my patch. It solves the problem when the duplicate paths are for different languages.
Comment #37
C. Lee CreditAttribution: C. Lee commentedI forgot to change the version to the latest. The above patch is for 7.x-3.x-dev.
Comment #38
complete CreditAttribution: complete commentedMan this solved it! Thank you! Works as a charm. Just patched the custom_menu_active_trail.inc file and cleared the cache, the problem is gone.
Comment #39
jmones CreditAttribution: jmones commentedsubscribe
Comment #40
Argus CreditAttribution: Argus commented#36 needs a bit more review
Comment #41
conspirolog CreditAttribution: conspirolog commented#36 I confirm that this solves subj. English-Russian. Works great, no side effects for 2 days of active menu creation-moving-deleting etc.
Comment #42
Ludo.RI have the same issue here using 7.x-2.2
Patch #36 works well for me!
Comment #43
peatonI'm having the same problem described in the title of this issue "Menu Block does not work with menu items pointing to the same destination" but not for a multilingual site. I have a nodes that need to appear in two or more places of the menu and point to the same destination but menu block does not show the submenu correctly.
However, the patch in #36 only works with the internationalization issue.
Does anyone have a patch that addresses the problem for non-multilingual situations?
Thanks.
Comment #44
mostou CreditAttribution: mostou commentedPatch in #36 works for me as well with a similar issue.
However this patch is dependant on the core workaround for this issue drupal.org/node/942782. Since this issue is fixed the core workaround will most likely be outphased soon (see http://drupal.org/node/1393204). Unless the workaround can be kept due to this issue http://drupal.org/node/609542, that is as far as I understand the core issue the patch in #36 is solving in Menu Block.
-----
Edit:
The core issue #609542 seems to be solved in Drupal 7.10 and i18n 7.x-1.2 (after a quick test). So patch in #36 may be unnecessary when the core workaround is removed (#1393204). Can other confirm this?
Comment #45
jimahuja CreditAttribution: jimahuja commented#43
I am having the same issue as mentioned in #43.
As per my reviews i found that the issue is when Drupal find the existence of first occurrence of link it stops finding the existence that if there is another link available for that node or not.
e.g. if i have NODE having 2 links in different menus, only menu with 'menu_name' coming first alphabetically is considered. say i have node/123 in menu_name = 'mennu-abc' and in menu_name = 'menu-xyz' so drupal always pick 'menu-abc' and stops looking of another occurrence of it. and hence, 'menu-abc' link will work fine with "Menu Block" but will not work for 'menu-xyz'.
Any Solutions for this issue?
Comment #46
jimahuja CreditAttribution: jimahuja commentedPlease check #45
I am having same issue
Comment #47
mostou CreditAttribution: mostou commentedPatch in #36 will no longer work due to http://drupal.org/node/1425342 - the file custom_menu_active_trail.inc is removed. I still have the described issue though, because I can no longer apply patch 36 with the latest version of Menu Block 7.x-2.3
This may now only be a core issue, since the workaround file custom_menu_active_trail.inc is no longer used by Menu Block. Can anyone with a more technical insight confirm this?
Possible duplicate: http://drupal.org/node/609542
Comment #48
mostou CreditAttribution: mostou commentedDue to #1425342: Drupal core upgrade from 7.10 to 7.12 causes menu block to fail this is no longer a Menu Block issue but an i18n issue. Duplicate issue here:
#1351678: Follow menu_link_get_preferred active trail handling for custom menus
The patch in the duplicate issue has been committed to i18n.
This issue should be solved with Drupal 7.12 + i18n 7.x-1.4 (+ Menu Block 7.x-2.3). If you still experience issues try and clear the cache.
Comment #49
KhaledBlah CreditAttribution: KhaledBlah commentedI had the same problem and I used http://drupal.org/project/nodesymlinks to get rid of it. NodeSymlinks will create "menu aliases" so that you can point to the same content in different menus with unique breadcrumb, trail and even URL.
Comment #50
yang_yi_cn CreditAttribution: yang_yi_cn commentedjust an update, I believe this issue is related to all custom menus, it just looks like happen when "menu items pointing to the same destination" because normally the 1st menu item is in the main menu and the 2nd menu item is in a custom menu.
I created a core issue at #1710744: Custom menus never receive an active trail (but system menu does).