[TIP] Adding menu item for addons

hi everybody;
i was playing with some addons and noticed that there is no top menu link for some of them.
Then i found some clue about how to do that at phpLiteAdmin addon.Pasting here for future usage and anybody who wants to use.
1- goto addon folder which you want to put link to top menu
2-open admin.php file
3-find the function below

$app->on('admin.init', function() {...will add the code here....}, 0);

4-set label, url and icon (In Capital letters)

$this->helper(‘admin’)->addMenuItem(‘modules’, [
‘label’ => ‘MENU_ITEM_LABEL’,
‘icon’ => ‘assets:app/media/icons/ICON.svg’,
‘route’ => ‘/ADDON_URL’,
‘active’ => strpos($this[‘route’], ‘/ADDON_URL’) === 0
]);

That’s it you have menu link at to menu for your addon