The sidebars are directly available in the ClientAreaPrimaryarySidebar and ClientAreaSecondarySidebar hooks.
To add a sidebar to your addon module, either add the hooks in hooks.php in your module root, or add a php file in the whmcs/includes/hooks directory and deal with your menus there (I prefer this approach - keeping menu organisation and configuration separate from the module).
<?php
use WHMCS\View\Menu\Item as MenuItem;
if (!defined("WHMCS")) {
die("This file cannot be accessed directly");
}
add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar){
$module = $_GET['m'];
switch ($module) {
case 'customAddonModule':
//Add new group to empty sidebar
$panel = $secondarySidebar->addChild(
'Quick Links',
[
'label' => 'Quick Links',
'order' => 1,
'icon' => 'fas fa-shopping-cart',
]
);
// Add individual links to group
$panel->addChild('customAddonModule')
->setLabel('This Module')
->setIcon('fas fa-ticket')
->setUri('/index.php?m=customAddonModule')
->setClass('active')
->setOrder(1);
$panel->addChild('things')
->setLabel('Buy Things')
->setIcon('fas fa-rabbit-in-headlights')
->setUri('/cart.php?gid=1')
->setOrder(2);
$panel->addChild('stuff')
->setLabel('Configure Stuff')
->setIcon('fas fa-drunk-man-looking-for-keys')
->setUri('index.php?m=anotherModule')
->setOrder(3);
break;
case 'anotherModule' :
//add another menu for another module
}
});