This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
jwilson8767
Sometimes you may need add items to October backend menus or to plugins. This may be accomplished by adding the following code to your plugin's boot method.
if (App::runningInBackend()) {
BackendMenu::registerCallback(function ($manager) {
//dd($manager); //uncomment to explore the current menu items
$manager->addSideMenuItem('Author.Plugin', 'mainmenuitem', 'mysidemenuitem', [
'label' => 'My Side Menu Item',
'icon' => 'icon-puzzle-piece',
'url' => Backend::url('my/plugin/page'),
'permissions' => ['my.plugin.access_page'],
'order' => 550
]);
});
}
Of special note: While you can add items to the October.Cms sidemenu, they will not function properly as the sidemenu functionality of this page is modified by october.sidepaneltab.js.
Last updated
Scott
Here is another approach to adding side menu items to a plugin:
# Plugin.php
public function boot()
{
// Extend the navigation
Event::listen('backend.menu.extendItems', function($manager) {
$manager->addSideMenuItems('Author.Plugin', 'mainmenuitem', [
'mysidemenuitem' => [
'label' => 'My Side Menu Item',
'icon' => 'icon-puzzle-piece',
'code' => 'mysidemenuitem',
'owner' => 'Author.Plugin',
'url' => Backend::url('my/plugin/page'),
],
]);
});
}
Last updated
1-2 of 2