Problem/Motivation
Per @Dries manually testing at #67893-37: add way to filter messages on severity, not just type, the breadcrumb is wrong when viewing dblog event details. It doesn't include a link to the parent path, since the menu structure of the dblog paths is inconsistent and the details pages currently live at admin/reports/event/%. So admin/reports/dblog (the parent from the UI) isn't actually the parent to the menu system, and the breadcrumbs get confused.
Steps to reproduce
- Install Drupal 7.
- Enable dblog module.
- Visit /admin/reports/dblog
- Click on the details of an event.
- The breadcrumbs can get you back to "Reports" but not "Recent log messages".
Proposed resolution
Change the path of the dblog details page to admin/reports/dblog/% so it can be a regular menu item and the breadcrumbs will All Just Work(tm).
Remaining tasks
- Decide on BC implications and if we need a redirect from
admin/reports/event/%toadmin/reports/dblog/% - Decide if we need/want to add test coverage of dblog breadcrumbs in here.
- Reviews / refinements.
- RTBC.
- Commit.
User interface changes
- Path to dblog detail pages changes from admin/reports/event/% to admin/reports/dblog/%
- Breadcrumbs now contain the parent page (the 'Recent log messages' page at admin/reports/dblog):
Before

After

API changes
None.
Data model changes
None.
Release notes snippet
TBD.
Original report by @dww
as reported by Dries at http://drupal.org/node/67893#comment-233462 (comment #37) the breadcrumb is wrong when viewing dblog event details. i originally thought this was due to the split from watchdog into dblog and syslog, but that's not the case. really, it's a problem of how the menu item is being defined (MENU_CALLBACK items don't get breadcrumbs, and this menu item really isn't just a menu callback), and the path we've been using for viewing event details (/admin/logs/event/X). so, there are 3 possible solutions:
- just remove the MENU_CALLBACK from the menu item. this leaves the breadcrumb as:
Home > Administer > Logs > Details. this is really a trivial fix, but the resulting breadcrumb is arguably not quite right, since the only way to navigate to the per-event item is via admin/logs/dblog ("Recent log entries"). - remove the MENU_CALLBACK, and keep the same path (/admin/logs/event/X) but manually set the breadcrumbs in dblog_event() to be more accurate. menu_set_location() is just a no-op in 6.x at this point, so the only way to get this working at all is via drupal_set_breadcrumb(). in other circles, i've come to believe that menu_set_location() is evil, anyway, so i'm happy to just use drupal_set_breadcrumb(). however, it still seems a little silly to use a different path and then manually force the breadcrumbs back into line.
- change the path to match the actual navigation structure (/admin/logs/dblog/X), and remove MENU_CALLBACK, then the breadcrumbs work automatically.
personally, i'd prefer #3, but i'm providing patches for each approach so the community and core maintainers can decide which one they think is best (and, since i was stuck on a plane all day, so i had no good way to get input from other people, and got all 3 working, anyway). ;)
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | After--patch--pic.png | 39.48 KB | vikashsoni |
| #29 | Before--patch--pic.png | 41.88 KB | vikashsoni |
| #27 | after_139015.png | 12.35 KB | guilhermevp |
| #27 | before_139015.png | 11.36 KB | guilhermevp |
| #25 | 139015-25.patch | 4.03 KB | dww |
Comments
Comment #1
dwwthis is the most trivial fix. just remove "MENU_CALLBACK" from the menu definition and it mostly works. however, breadcrumbs become:
Home > Administer > Logs > DetailsComment #2
dwwleave the path for the menu item at /admin/logs/event/X, but manually set more accurate breadcrumbs with drupal_set_breadcrumb(). breadcrumbs are now:
Home > Administer > Logs > Recent log entries > DetailsComment #3
dwwIMHO, best approach: remove MENU_CALLBACK, but change the path for the dblog event detail page from /admin/logs/event/X to /admin/logs/dblog/X. no manual setting of breadcrumbs, but they're still the most accurate possible:
Home > Administer > Logs > Recent log entries > DetailsComment #4
AmrMostafa commentedbreadcrumbs are great with #3, but now 'Details' appear in the menu
Comment #5
dries commentedThis looks a bit awkward. The 'Details' is shown in the breadcrumb and in the title .. is this is menu system bug maybe?
Comment #6
AmrMostafa commentedI'm do not know the menu system well enough, but I've done the following MENU_CALLBACK test on both HEAD and 5.x and the result came different. In 5.x the breadcrumbs indicates the item parents. While in 6.x, the parents are disregarded.
Regarding the title, can we modify it so instead of 'Details' it would be 'Watchdog entry details' ?
Comment #7
dww@Dries: yes, in D6 menu land, breadcumbs always go all the way up to the current page. look anywhere in D6, and you'll see the same thing. if we don't like that, it's a menu system bug, and we should file a separate issue for that. i suspect it's a trivial 1 line change to the right function, but i'm sure chx could fix it even faster than i could. ;)
@alienbrain: re: the title -- that's just the title of the page itself. if we want a different title, we could change it, but that's sort of orthogonal to what this issue is trying to solve.
therefore, i think this (#3, in particular) still needs review.
thanks,
-derek
Comment #8
AmrMostafa commentedI think the breadcrumb is fine, except that now 'Details' appears on the menu too. I don't know of a solution or what could be the right menu type/flags to use in order to fix this.
Just thinking out loudly, this patch removes MENU_CALLBACK which defaults the item to MENU_NORMAL_ITEM, hence it appears in the breadcrumb and the menu. But I feel MENU_CALLBACK was the appropriate type here, and it's the menu system fault that MENU_CALLBACK type causes the breadcrumb to loose the parents causing the wrong "Home > Details" breadcrumb.
Comment #9
dries commenteddww: thanks for pointing out that this is a menu system glitch. Can be fixed later.
I also noticed that 'Details' appears in the menu or on the admin overview page -- something is still wrong.
Comment #10
dries commentedalienbrain: I think you might be right. However, I just checked a Drupal 5 install, and it also has a breadcrumb problem with the log pages. So maybe the behavior of MENU_CALLBACK is consistent with the old Drupal 5 behavior -- but admittedly b0rked in this use case. Let's call the Menu Man?
Comment #11
dwwsee http://drupal.org/node/139303 about D6 breadcrumbs including the current page.
Comment #12
chx commentedYes, breadcrumbs are broken and I will not fix this next week but as said in the other issue i do not want to meddle with menu builder while pwolanin is working on it. And I do not readily have the time anyways.
Comment #13
chx commentedOn another note, #3 is almost the solution but removing MENU_CALLBACK is not needed. Of course, if you do not remove it now then it'll broken but that's just because menu.inc is broken. Not a biggie.
Comment #14
dries commentedchx: so you advice to put this patch on hold for a couple days (weeks)?
Comment #15
keith.smith commentedUnfortunately patch no longer applies cleanly.
# patch -p0 < dblog_breadcrumb_path.patch.txt
patching file modules/dblog/dblog.module
Hunk #1 FAILED at 67.
Hunk #2 succeeded at 165 (offset -15 lines).
1 out of 2 hunks FAILED -- saving rejects to file modules/dblog/dblog.module.rej
Comment #16
AmrMostafa commentedThe issue still applies to HEAD, and patch at #3 doesn't fix it.
Comment #17
davyvdb commentedComment #19
davyvdb commentedComment #21
panchoRerolled patch against HEAD.
Also, reordered the entries in dblog_menu() for more clarity about what belongs together.
Also, renamed page title from the inexpressive "Details" to "Event details" (However, I'm not sure whether this is still acceptble in 7.x)
Comment #23
dwwRe-found this as part of my #BugSmash homework to triage the bug reports I opened. ;) This bug is still present in D7, so I rerolled this. Interdiff is sort of confused. I think I fixed the tests, but let's see. ;)
Comment #25
dwwThis is what caused the test failure. I'm not sure we want/need to do that. So I'm reverting the page title change and the test now passes locally.
I'm wondering about the "BC" implications of changing the path for these pages, too. Are folks that wrote things to scrape these pages going to be sad?
Should we add a redirect from admin/reports/event/% to admin/reports/dblog/% ?
Meanwhile, summary update with before/after screenshots.
Comment #26
dwwFormatting updates to the summary, shrink the embedded screenshots, and properly link to the original bug report (where Dries was manually testing this). ;)
Comment #27
guilhermevp commentedPatch works as intended. I'm also in favor of decision #3. Not moving to RTBC because I believe that at this point it should be a decision made by the maintainers. Just adding to the discussion.
Before:

After:

Comment #28
roderikMmm. Good question. The admin/reports/event/% paths are transient, but I am kind-of wary that someone made their own overview and we don't want to break that. So we likely should implement the redirect.
E.g. https://www.drupal.org/project/views_watchdog - I haven't checked whether it includes (hardcoded) URLs to individual menu entries; I just imagine it does and otherwise there may be similar code around that we don't want to break.
(Edit - actually I'm wrong, views_watchdog doesn't have links to the detail page / doesn't want to use Core's detail page. So you can disagree. I'm still wary that in the current D7 install base, people are depending on it, though.)
So, needs:
I'm going to just go ahead and set Needs Work for this. Have added to #3216978: [meta] Priorities for 2021-12-01 release of Drupal 7 so there's, uhm, a non-zero chance this will get into the December release. (The maintainers are trying and hopefully succeeding to get a little extra assistance, by then.)
Comment #29
vikashsoni commentedApplied patch #25 working fine and looks good for me
For ref sharing screenshot...