Giter Club home page Giter Club logo

adminbundle's Introduction

VinceTAdminBundle

This bundle extends the SonataAdminBundle and allow 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 the list of Admin objects.

This bundle extends the menu and allows everyone to modify this menu.

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

To modify the admin menu juste create a listener :

namespace VinceT\TestBundle\EventListener;


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

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

        // move user to System group
        $users = $menu->pop('sonata_user');
        $menu['System']->addChild($users);
        
        // add a divider to System group
        $menu['System']->addDivider();
        // ad a nav header
        $menu['System']->addNavHeader('Informations');

        // add About child
        $menu['System']->addChild('About', array('uri'=>'#'));
        // add children to About
        $menu['System']['About']->addChild('Symfony', array('uri'=>'http://symfony.com'));
        $menu['System']['About']->addChild(
            'SonataAdminBundle', 
            array(
                'uri'=>'http://sonata-project.org/bundles/admin/master/doc/index.html'
            )
        );
        $menu['System']['About']->addChild('VinceTAdminBundle', array('uri'=>''));

    }
}

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

services:
    kernel.listener.admin_menu_listener:
        class: VinceT\TestBundle\EventListener\MenuListener
        tags:
            - { name: kernel.event_listener, event: admin.menu.create, method: createMenu }

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

adminbundle's People

Contributors

vincenttouzet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.