Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The menu items consists of <li><a></a></li>
, but only the <a>
element has the 'active' class (for the active menu item). The active <li>
has the active-trail class, but that is not enough. For bootstrap to style correctly the <li>
element needs to have the 'active' class.
Jarl
Comment | File | Size | Author |
---|---|---|---|
#3 | bootstrap-add_active_class_to_li_elements-1896674-2.patch | 994 bytes | andregriffin |
#1 | bootstrap-add_active_class_to_li_elements-1896674-1.patch | 1008 bytes | generalredneck |
Comments
Comment #1
generalredneckThis should take care of the problem. It worked for me.
Comment #2
andregriffin CreditAttribution: andregriffin commentedComment #3
andregriffin CreditAttribution: andregriffin commentedReroll against dev
Comment #4
generalredneckMy bad.
Comment #5
andregriffin CreditAttribution: andregriffin commentedThanks.
Comment #7
markhalliwellThe
$language_url
variable (towards the end) is actually not defined in this function. Where is it coming from??Stumbled upon this when refactoring for 8.x-2.x. Would change the version for this issue, but that branch doesn't have a "release" yet. Tagging for backport.
Comment #8
markhalliwellComment #9
byteways CreditAttribution: byteways commentedYep, it looks like $language_url is a global variable and should be declared as such in bootstrap_menu_link(), am I correct?
Comment #10
clarkorz CreditAttribution: clarkorz commentedDoesn't work with Context menu reaction.
Comment #11
regilero CreditAttribution: regilero commentedMaybe I do not understand everything, but.. the problem here is to add 'active' when only 'active-trail' is present?
Then why not simply doing it?
Current patch tests the href with q argument, but this will not work for active-trail set via menu_tree_set_path or menu_set_active_trail, as by definition theses things are used to set active trail on things where the path is not an obvious way of finding the active trail.
Comment #13
markhalliwellI'm just moving this back to 7.x. If there needs to be any re-evaluation for 8.x, create a new issue.
Comment #14
kristiaanvandeneynde+1 for regilero in #11
This patch that went in breaks the use of hook_preprocess_menu_link() to unset the active class on a link on the front page.
Comment #15
markhalliwellPlease do not re-open old issues.
Comment #16
kristiaanvandeneyndeFine. #2618828: Move menu_link "active" class logic into a preprocess function and base it on "active-trail"