Problem/Motivation

#1979468: ".active" from linkGenerator(), l() and theme_links() forces an upper limit of per-page caching for all content containing links optimized the setting of the .active class on links. Unfortunately, we missed one spot: menu_navigation_links()'s logic.

To make matters worse, the current logic is inherently wrong: on all "navigation links"-style menus (which includes the "primary" menu and the "secondary" menu, which contain the "Home" link and the "Log in/log out/register" links, respectively, out of the box) will get the .active class set precisely when they're not active!

Encountered while working on #1805054: Cache localized, access filtered, URL resolved, and rendered menu trees.

Proposed resolution

Delete the obsolete code; #1979468: ".active" from linkGenerator(), l() and theme_links() forces an upper limit of per-page caching for all content containing links will handle it for us automatically.

Remaining tasks

None.

User interface changes

None.

API changes

None.

CommentFileSizeAuthor
#1 2271025-1.patch887 bytesWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Status: Active » Needs review
FileSize
887 bytes

Also, local tasks have their own independent "active" handling, see LocalTaskInterface::(set|get)Active(), so it probably should already have been deleted as part of #2004334: Separate Tabs (MENU_LOCAL_TASK) from hook_menu().

The breakage itself was introduced in #2177031: Remove menu_get_item() and every use of it. .

Now we can finally lay this small chunk of code to rest :)

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, let's remove that. This is confusing as hell if you try to figure out where the active class it set.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Good catch. Committed and pushed to 8.x. Thanks!

Wim Leers’s picture

Issue tags: -sprint

  • Commit df710a8 on 8.x by webchick:
    Issue #2271025 by Wim Leers: Don't let menu_navigation_links() set the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.