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.
Administration > Structure > Menus > (example) Navigation > List Links > Add content > Edit
Top of the page shows "Edit menu link" but not which menu you are editing, which should be shown.
A simple request
Comment | File | Size | Author |
---|---|---|---|
#25 | add_menu_name_to_breadcrumb-1009832-24test-only.patch | 637 bytes | no_commit_credit |
#22 | add_menu_name_to_breadcrumb-1009832-22.patch | 1.71 KB | chertzog |
#19 | corrected_bc.PNG | 19.97 KB | Shyamala |
#18 | add_menu_name_to_breadcrumb-1009832-18.patch | 1.08 KB | chertzog |
#17 | add_menu_name_to_breadcrumb-1009832-17.patch | 1.08 KB | chertzog |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is still true in D8 and still a good suggestion.
Comment #2
edb CreditAttribution: edb commentedThis code will add the menu title to the breadcrumb and page title when placed in edit_menu_item(). I will roll a patch when I get the time
Comment #3
edb CreditAttribution: edb commentedHeres the patch
Comment #5
edb CreditAttribution: edb commentedOops, when adding a menu, the correct breadcrumb is already displayed! Rerolled with the fix, also changed the title to 'Add menu item' when on the add page, rather the 'Edit menu item'.
Comment #6
edb CreditAttribution: edb commentedComment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedJust testing this out quickly, I notice that it does add a the breadcrumb to the Link edit page (great!), but not to the List Links page. It should probably be in the list links page as well.
I'm not sure if we have to go as far as changing the title. For example, if you edit a field on a content type, you see the name of the content type in the breadcrumb but not in the page title. I think we should probably mirror that functionality.
Comment #8
edb CreditAttribution: edb commentedRolled patch with suggestions from #7
Comment #10
rjgoldsborough CreditAttribution: rjgoldsborough commented#8: 1009832-add-menu-name-3.patch queued for re-testing.
Comment #12
kathyh CreditAttribution: kathyh commentedTook a quick look and the patch is failing due to the breadcrumb testing in modules\simpletest\tests\menu.test for these two:
This one needs an additional element (navigation) added to the simpletest:
Line 1113: $this->assertBreadcrumb('admin/structure/menu/manage/navigation', $trail);
This test assertion:
Line 1120: $this->assertBreadcrumb('admin/structure/menu/manage/navigation/add', $trail);
fails because the breadcrumb is displaying:
Home » Administration » Structure » Menus » Navigation » Navigation
Is the double navigation in the breadcrumb the desired behavior?
Passing it back for discussion - whether to update the simpletest or the code (esp for the latter).
Comment #13
rjgoldsborough CreditAttribution: rjgoldsborough commentedThis patch should do the trick. We can't seem to test for $this->assertBreadcrumb('admin/structure/menu/manage/navigation', $trail);
Realistically this should have a url like navigation/list similar to /edit and /add.
If we leave that line in, it tries to test a breadcrumb with two of the same crumbs in a row which will make the test fail.
Comment #15
rjgoldsborough CreditAttribution: rjgoldsborough commented#13: add_menu_name_to_breadcrumb_1009832_13.patch queued for re-testing.
Comment #16
xjmThanks for working on this! Here's a few things to fix:
Let's please remove the commented debug code. :)
Rather than removing this assertion, shouldn't we replace it with an updated one?
Few points for cleanup here:
Reference: http://drupal.org/node/1354#inline
There's a bit of trailing whitespace here.
Also, let's get a screenshot of the change. (Crop the screenshot to only the relevant portion of the screen.) Thanks!
Comment #17
chertzogWhile working on this I noticed quite a difference across different modules in core.
For example:
Taxonomy
Vocabulary "list" page does not have the vocabulary title in the breadcrumb. However, the vocabulary title is put into the breadcrumb on the "edit", "manage fields", and "manage display" pages. And the page title on all of the pages remains just the vocabulary title.
On the "add term" page the breadcrumb shows the vocabulary title in the breadcrumb, and the page title is the vocabulary title. But on the term edit page, the breadcrumb is just "Home -> 'term'" and the title is "term."
Fields
On the content type "edit" page, the breadcrumb does not show the content type title. However, on the rest of the tabs "manage fields," "manage display," etc. the content type does show in the breadcrumb. And like taxonomy, the title remains the same throughout.
Unlike the taxonomy and menu, there is no separate "add" page for fields. The "add" page and "list" page are combined into one interface. But then if we add a field, the first page we get the breadcrumb is:
And as soon as we save the field settings and are directed to the field "edit" page the breadcrumb becomes:
Notice the field name is not present. But if you go back to either the "field settings" or "widget type" pages, the field name will show back up in the breadcrumb. And across all of these pages, the title of the page just the field name.
Menu
On the Menu list links page, the menu name is not in the breadcrumb, but is in the breadcrumb on the "edit menu" page which links back to the list links page. Both pages have the menu name as the page title. On the add link page the menu title is added to the breadcrumb, and the page title remains the menu title. But on the "edit link" page, the menu title is NOT in the breadcrumb, and the title as changed to "Edit menu link."
SO...
I think the only thing that we can do that makes any sense is add the menu title to the breadcrumb on the "edit link" page. Attached is a patch which adds this. Though since the menu name is already added to the breadcrumb on the "add" page, we only need to add it to the "edit link" page. So since the first line of the function is an if statement checking whether this is an add, i just added an else statement to hold the code.
Comment #18
chertzogD7 Patch attached if desired.
Comment #19
Shyamala CreditAttribution: Shyamala commented#17 - The code corrects the menu on the edit menu link page.
Attached screenshot.
Comment #20
Shyamala CreditAttribution: Shyamala commented#18 corrects the same in Drupal 7.
Comment #21
xjmThanks for the screenshot. Can we get a screenshot of the behavior before it is fixed as well?
There's a bunch of trailing whitespace on this line, so let's remove that from the patch.
Also if someone wants to add a hyphen to "human-readable" that would be good. :)
Finally, I think we still need an automated test for this.
Comment #22
chertzogHere is a patch with a test, and a screenshot.
Comment #23
chertzogComment #24
xjmThanks @chertzog! I requeued the test on QA.
Comment #25
no_commit_credit CreditAttribution: no_commit_credit commentedComment #26
xjm...And the above is the test in a patch by itself, to expose the presumed failure without the fix.
Comment #28
xjmTest fails alone and passes with the fix; patch looks clean now -- I think this is RTBC (#22). :)
Comment #29
webchickOk, I think I get it. So #22 is the "before" screenshot, #19 is the "after" screenshot, and the difference is that the name of the menu you're editing is in the breadcrumbs, for better orientation. That seems like a nice improvement to me, and it should even be safe for backport since it doesn't introduce any new strings.
Committed and pushed to 7.x and 8.x. Thanks!
Comment #31
cweagansUpdating tags per http://drupal.org/node/1517250