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.
Our check did not count on the case that you might use a non-t callback so
if (!$link_translate || (!empty($item['title']) && ($item['title'] == $item['link_title']))) {
needs a change to
if (!$link_translate || ( ( !empty($item['title']) || $item['title_callback'] != 't' ) && ($item['title'] == $item['link_title']))) {
however this can be simplified because the only case ( !empty($item['title']) || $item['title_callback'] != 't' )
is FALSE
when nor the title nor the title callback is specified in hook_menu (and because of that the default t is used) and that's broken code http://drupal.org/node/140311 does not list this as a valid case. So we can drop it and get the simple
if (!$link_translate || ($item['title'] == $item['link_title'])) {
code.
D7 patch and test is forthcoming but as this affects d.o. sprint I am inclined to ask for an exception and get it into D6 quick.
Comment | File | Size | Author |
---|---|---|---|
#11 | menu.inc_.patch | 1.16 KB | webchick |
#9 | link_title.patch | 1.2 KB | chx |
#3 | link_title.patch | 1.33 KB | chx |
link_title.patch | 1.33 KB | chx | |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedlooks like a reasonable approach, but I'll review in more detail.
Comment #2
drumm+1 works on my test site that uncovered the bug.
Comment #3
chx CreditAttribution: chx commentedResubmitting for bot review.
Comment #4
pwolanin CreditAttribution: pwolanin commentedpatch applies with offset to D7 also
Comment #5
David StraussCould we add a unit test for this?
Comment #6
chx CreditAttribution: chx commentedGet http://drupal.org/node/204077 in and then we have it tested. That one produces three fails in blog test without this.
Comment #7
chx CreditAttribution: chx commentedComment #8
webchickWhile those comments very accurately describe what the code is doing, I'm sure, they read exactly like "wah wah wah" to someone without internal menu system knowledge. ;)
Let's describe the behaviour that we're testing for here, hm?
Comment #9
chx CreditAttribution: chx commentedComment #10
webchickCommitted to HEAD with a couple small grammar fixes.
Setting back to 6.x for consideration.
Comment #11
webchickSorry, here's the patch I used.
Comment #12
Gábor HojtsyThanks, committed #11 to Drupal 6 too.