slawkens / myaac

A free and open-source Automatic Account Creator (AAC) written in PHP
https://my-aac.org
GNU General Public License v3.0
125 stars 99 forks source link

feat: add hook admin menu #208

Closed gpedro closed 1 year ago

gpedro commented 1 year ago

allows to add new admin menus using hooks

examples:

global $menus;

// new menu
$menus[] = [
    'name' => 'Custom Admin Tools',
    'icon' => 'tools',
    'order' => 21,
    'link' => [
        ['name' => 'BAdmin', 'link' => 'admin', 'order' => 2],
        ['name' => 'Admin', 'link' => 'admin', 'order' => 1]
    ]
];

// new sub menu on existing menu
foreach ($menus as $i => $menu) {
    if (isset($menu['name']) && $menu['name'] === 'Tools') {
        $menus[$i]['link'][] = ['name' => 'Xablau', 'link' => 'admin', 'order' => 0];
        break;
    }
}
Captura de Tela 2022-11-28 às 13 01 16
slawkens commented 1 year ago

As always, great content from @gpedro!

Thanks for this contribution and love your idea!