Skip to content

Commit

Permalink
Initialize menus with menu_categories
Browse files Browse the repository at this point in the history
If user add custom categories, it will fix an issue where Menu is not collapsed
  • Loading branch information
slawkens committed Jan 17, 2025
1 parent dc2b5af commit 4f6178e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion templates/tibiacom/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,23 @@ function LoginstatusTextAction(source) {
menu[0] = {};
var unloadhelper = false;

<?php
$menuInitStr = '';
foreach ($config['menu_categories'] as $item) {
if ($item['id'] !== 'shops' || setting('core.gifts_system')) {
$menuInitStr .= $item['id'] . '=' . ($item['id'] === 'news' ? '1' : '0') . '&';
}
}
?>

// load the menu and set the active submenu item by using the variable 'activeSubmenuItem'
function LoadMenu()
{
document.getElementById("submenu_"+activeSubmenuItem).style.color = "white";
document.getElementById("ActiveSubmenuItemIcon_"+activeSubmenuItem).style.visibility = "visible";
menus = localStorage.getItem('menus');
if(menus == null || menus.lastIndexOf("&") === -1) {
menus = "news=1&account=0&community=0&library=0&forum=0<?php if (setting('core.gifts_system')) echo '&shops=0'; ?>&";
menus = "<?= $menuInitStr ?>";
}
FillMenuArray();
InitializeMenu();
Expand Down

0 comments on commit 4f6178e

Please sign in to comment.