2017-03-30, 08:35 AM
Found that the submenu creation in ACP is designed for plugin devs to adding own menu entry's in the spaces between of exist entry's. Good to see at the choosed numbers for the core menu entrys like here:
https://crossreference.mybb.de/admin/modules/tools/module_meta.php.source.html
But the add_menu_items function missed to sort them before generating the output for the sidemenu:
https://crossreference.mybb.de/nav.html?admin/inc/class_page.php.source.html#l1106
This can easy be fixed by adding a ksort befor the foreach loop.
And the menus can be now better sorted by plug devs. This give the ability for a better overview and readability.
https://crossreference.mybb.de/admin/modules/tools/module_meta.php.source.html
But the add_menu_items function missed to sort them before generating the output for the sidemenu:
https://crossreference.mybb.de/nav.html?admin/inc/class_page.php.source.html#l1106
This can easy be fixed by adding a ksort befor the foreach loop.
function add_menu_items($items, $active)
{
global $run_module;
ksort($items, SORT_NUMERIC);
$this->_contents = "<ul class=\"menu\">";
foreach($items as $item)
{
if(!check_admin_permissions(array("module" => $run_module, "action" => $item['id']), false))
{
continue;
}
$class = "";
if($item['id'] == $active)
{
$class = "active";
}
$item['link'] = htmlspecialchars_uni($item['link']);
$this->_contents .= "<li class=\"{$class}\"><a href=\"{$item['link']}\">{$item['title']}</a></li>\n";
}
$this->_contents .= "</ul>";
}
And the menus can be now better sorted by plug devs. This give the ability for a better overview and readability.