Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Admin Menu Bundle Laravel Package

devilcius/admin-menu-bundle

View on GitHub
Deep Wiki
Context7

AdminMenuBundle

Build Status

This is based on AdminBundle and extends the SonataAdminBundle. It offers the possibility to manage the menu from other bundle.

See how to install and configure

Manage menu

The SonataAdminBundle main menu (on top of all Admin pages) is generated with a list of Admin objects.

This bundle extends the menu and allows everyone to modify via the service container.

The admin menu is generated with KnpMenu library. By default it retrieves all admin groups and labels Admin (like the default menu renderer).

To modify the admin menu just register a listener :


namespace devilcius\TestBundle\EventListener;


class MenuListener
{
    public function createMenu($event)
    {
        $menu = $event->getMenu();

        // create a new group
        $menu->addChild('Audit', array('translationDomain'=>'MyDomain'));

        // add a divider to System group
        $menu['Audit']->addDivider();
        // ad a nav header
        $menu['Audit']->addNavHeader('SubMenu');

        // add list child (with a route declared in routing.yml)
        $menu['Audit']->addChild('List', array('uri' => $this->router->generate('get_audit_list')));

    }
}

And just declare the listener in your services.yml file.

services:
    kernel.listener.admin_menu_listener:
        class: devilcius\TestBundle\EventListener\MenuListener
        tags:
            - { name: kernel.event_listener, event: admin.menu.create, method: createMenu }
        arguments: [@router]

This bundle use a custom MenuItem class devilcius\AdminMenuBundle\Menu\MenuItem that extends the Knp\Menu\MenuItem. It add new functions (dividers, nav headers, ...)

Controllers used in the the admin menu must extend the AdminMenuController

use devilcius\AdminMenuBundle\Controller\AdminMenuController as Controller;
class AuditController extends Controller
{
[...]
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware