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.
Currently, function 'menu_set_location' is a placeholder and as result it's not possible to set custom breadcrumbs. Now this is done (well, at least tried) in blog, comment, forum and taxonomy module.
Comment | File | Size | Author |
---|---|---|---|
#14 | brood_01.patch | 7.56 KB | desbeers |
#6 | menu_set_item_0.patch | 1.94 KB | chx |
#5 | menu_set_item.patch | 1.93 KB | chx |
#1 | bread-menu-01.patch | 708 bytes | desbeers |
Comments
Comment #1
desbeers CreditAttribution: desbeers commentedI gave it a shot; attached a patch that restores the custom breadcrumb function; although is by no means like the previous version of 'menu_set_location'.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedMSL does more than just breadcrumb
Comment #3
desbeers CreditAttribution: desbeers commentedYes, it does a lot more, but frankly; I have no clue what it's doing more 'in practice'. I read the documentation for D5 and it still wasn't clear. A search in core showed me it's really only used for breadcrumbs.
I asked help from Chx on IRC and he had also no clue about it; it's a mysterious function :-)
menu_set_location can't be dumped in my opinion as we are in code-freeze. But something has to be done with it. I suggest to make it 'breadcrumb' only (like I did in the patch); include new doxigen and rework it for D7.
Comment #4
Crell CreditAttribution: Crell commentedIn D5, menu_set_location() is also how you change what menu blocks and primary/secondary links will be active. It changes the entire, well, menu location. That it affects breadcrumbs display is just one symptom of that.
Losing menu_set_location() would be quite bad, as that's a regression that would hose a site I just launched. :-)
Comment #5
chx CreditAttribution: chx commentedPoor menu_set_item, it got removed but why? I have no idea. It was mighy useful. I have readded with copius comments. I can't see what review could add to the issue so I set it to RTBC as this is a somewhat new function. It was in HEAD but it was removed with the multiple menu patch , I checked the issue and there was no mention of it. It either was oversight or we thought the load functionality supersedes it but apparently that's not the case. If you search on $_GET['q'] in menu.inc you will immediately see that menu_get_item is the only place where it used (aside from menu_set_active_item which is not called by core) and everything else relies on
menu_get_item()
so this is what Crell wants.Comment #6
chx CreditAttribution: chx commentedSpaces, capitalization in doxygen.
Comment #7
Gábor HojtsyIndeed, quite simple, thanks, committed.
Comment #8
desbeers CreditAttribution: desbeers commentedNow function 'menu_set_location' in menu.inc is gone, but this function was used in blog, comment, forum and taxonomy module....
Viewing a 'blog' node on localhost/node/% for example gives a fatal error now.
Will look at it later today.
Comment #9
Gábor HojtsyWell, reverted the patch in anticipation of a better one. (bjaspan also reported an issue about this problem in the meantime).
Another schoolbook case on why someone should not RTBC his own patches (and why a core committer should look at patches more thoroughly).
Comment #10
Gábor HojtsyComment #11
chx CreditAttribution: chx commentedI should have removed the menu_set_location in a separate patch but I will RTBC my own similar patches in the future. It's a waste of time to try to get a review on such stuff.
Comment #12
desbeers CreditAttribution: desbeers commentedCurrently, menu_set_location is 'misused' on several places in core to set a custom breadcrumb. I tested Chx path and it's working well. It sets the location correctly; alters title and navigation-block and set the breadcrumb. But it offers no way to set a 'custom' breadcrumb like we do in blog.module for example.
In 'node.pages.inc' the breadcrumb is set directly with function drupal_set_breadcrumb. The other modules should do the same. I will make a patch for that later today.
Comment #13
bjaspan CreditAttribution: bjaspan commentedSubscribe.
Comment #14
desbeers CreditAttribution: desbeers commentedAttached a patch that removes all the 'mis-use' of the function 'menu_set_location'.
It was only used to set a 'custom-breadcrumb' and with this patch it's setting it in a proper way. Just 'set the breadcrumb'.
Chx's patch attached to #6 is exactly doing what it should and this patch solves the fatal-errors as a result of that.
Modeles and functions affected:
- blog.module (blog_view)
- taxonomy.pages.inc (taxonomy_term_page)
- comment.module (comment_reply)
- forum.module (forum_nodeapi and template_preprocess_forums)
In the php-doc's (that were already there) you can see that it was really just about breadcrumbs and never to 'set-a-location'.
Comment #15
chx CreditAttribution: chx commentedReviewing (and no, desbeers have not told me on IRC).
Comment #16
chx CreditAttribution: chx commentedNicely done, thanks. I truly hope there are no other ancient remnants of the old menu system.
Comment #17
Gábor HojtsyCommitted, thanks.
Comment #18
stella CreditAttribution: stella commentedI've updated the "Converting 5.x modules to 6.x" documentation to include a section on this issue, as core modules aren't the only ones affected. Please feel free to modify it if required: Use drupal_set_breadcrumb() instead of menu_set_location() to set custom breadcrumbs.
Cheers,
Stella
Comment #19
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.