#4502 closed Defect (fixed)
Plugin provided menu item_class gets overwritten if item is the selected item
| Reported by: | mikehedman | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.6 |
| Component: | Core | Version: | 1.8.4 |
| Severity: | minor | Keywords: | menu item |
| Cc: | brett@… | Difficulty: |
Description
In views\default\navigation\menu\elements\item.php, the following code replaces the menu item's item_class property if the item is the selected menu item:
if ($item->getSelected()) {
$item->setItemClass('elgg-state-selected');
$link_class = 'elgg-menu-opened';
}
My plugin is setting an item_class in order to style a specific menu item, but when it is the selected item, my class gets wiped out by this code.
I'm working on getting this patch submitted, but here's the code that I've replaced it with on my site:
if ($item->getSelected()) {
$item_class_array = explode(' ', $item->getItemClass());
$item_class_array[] = 'elgg-state-selected';
$item->setItemClass($item_class_array);
$link_class = 'elgg-menu-opened';
}
Change History (4)
comment:1 Changed 13 months ago by ewinslow
- Milestone changed from Needs Review to Elgg 1.8.x
comment:2 Changed 11 months ago by cash
- Milestone changed from Elgg 1.8.x to Elgg 1.8.6
comment:3 Changed 11 months ago by Cash Costello
- Resolution set to fixed
- Status changed from new to closed
comment:4 Changed 11 months ago by Cash Costello
Fixes #4502 selected menu items maintain plugin provided classes
Changeset: b6daeeff44535de77f81396d6690f6eedbf57708

Fixes #4502 selected menu items maintain plugin provided classes