Bug #21493
closedJSMENU's showActive is broken
0%
Description
The implementation of the JSMENUITEM property "showActive" is (very) flawed. It only works for a small subset of all possible HMENU configurations:
- Most HMENU.special variants (directory, list, browse,...) will stopp showActive from working.
- Any HMENU properties that change the menu to something other than a tree starting at the root page of the website (e.g. HMENU.entryLevel) will also break the function of showActive.
- Mountpoints in the root line will stopp showActive from working.
The problem is very simple to solve. The JSMENU code to determine if a page is active is found in /typo3/sysext/cms/tslib/class.tslib_menu.php:
$active = ($levelConf['showActive'] && $data['uid'] == $this->tmpl->rootLine[$count]['uid']);
This is very simplistic and will not work in any more complex cases (as listed above). The funny thing is that the same php file contains the method tslib_menu::isActive(), which does exactly (and does right) what JSMENU tries to do with the flawed approach above.
So simply replacing that line by...
$active = ($levelConf['showActive'] && $this->isActive($data['uid'], $MP_var));
...does the job.
Patches for 4.2.10 and 4.3.0beta2 are attached.
(issue imported from #M12505)
Files