2017 © Pedro Peláez
 

symfony-bundle admin-menu-bundle

Extended menu to use with Symfony2 and sonata-admin

image

devilcius/admin-menu-bundle

Extended menu to use with Symfony2 and sonata-admin

  • Thursday, October 3, 2013
  • by devilcius
  • Repository
  • 2 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

AdminMenuBundle

Build Status, (*1)

This is based on AdminBundle and extends the SonataAdminBundle. It offers the possibility to manage the menu from other bundle., (*2)

See how to install and configure, (*3)

Manage menu

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

This bundle extends the menu and allows everyone to modify via the service container., (*5)

The admin menu is generated with [KnpMenu][4] library. By default it retrieves all admin groups and labels Admin (like the default menu renderer)., (*6)

To modify the admin menu just register a listener :, (*7)


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., (*8)

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, ...), (*9)

Controllers used in the the admin menu must extend the AdminMenuController, (*10)

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

The Versions

03/10 2013

dev-master

9999999-dev https://github.com/devilcius/AdminMenuBundle

Extended menu to use with Symfony2 and sonata-admin

  Sources   Download

MIT

The Requires

 

by Marcos

bundle symfony sonata-admin