Edit on GitHub
Jump to docs navigation

Extending / Intermediate / Back-end Menu Items

Note: You are currently reading the documentation for Bolt 3.1. Looking for the documentation for Bolt 3.5 instead?

Bolt allows extensions to insert submenus under the Extras menu in the admin UI.

Bolt provides a helper function that will allow additional MenuEntry objects to be added to the admin UI menus when they are built in the Bolt\Menu\AdminMenuBuilder class.

Registering Menu EntriesΒΆ

Menu objects for registration can be created using a Bolt\Menu\MenuEntry class object.

    protected function registerMenuEntries()
    {
        $menu = new MenuEntry('koala-menu', 'koala');
        $menu->setLabel('Koala Catcher')
            ->setIcon('fa:leaf')
            ->setPermission('settings')
        ;

        return [
            $menu,
        ];
    }

In the above example:

  • koala-menu parameter in the constructor is used internally and should just be a brief name, and only needs to be unique for submenus of Extend.
  • koala parameter in the constructor will set the route for the menu to be bolt/extend/koala (where branding path is still set to bolt/
  • setLabel('Koala Catcher') sets the displayed menu label in the left side bar to "Koala Catcher"
  • setIcon('fa:leaf') set the icon for the menu to any of the Font Awesome icons
  • setPermission('settings') sets the required permission, as defined in the app/config/permissions.yml file

Note: Menu entries are mounted on extend/, because they show up under the 'Extras' menu option. When adding an accompanying route for a new menu item, make sure to catch it correctly. For the above example, it should match /extend/koala.

Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on IRC.