2017 © Pedro Peláez
 

symfony-bundle menu-bundle

This bundle provides a menu bundle for symfony2

image

desarrolla2/menu-bundle

This bundle provides a menu bundle for symfony2

  • Tuesday, March 20, 2018
  • by desarrolla2
  • Repository
  • 2 Watchers
  • 1 Stars
  • 1,628 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 11 % Grown

The README.md

MenuBundle

The MenuBundle means easy-to-implement and feature-rich menus in your Symfony application!, (*1)

Installation

Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require desarrolla2/menu-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:, (*4)

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Knp\Bundle\Desarrolla2\MenuBundle(),
        );

        // ...
    }

    // ...
}

Create your first menu

An example builder class would look like this:, (*5)


<?php namespace AdminBundle\Menu; use Desarrolla2\MenuBundle\Menu\MenuInterface; class MainMenu implements MenuInterface { public function getMenu() { return [ 'class' => 'sidebar-menu', 'items' => [ [ 'name' => 'Users', 'icon' => 'fa fa-user', 'items' => [ [ 'name' => 'Admins', 'route' => 'admin_core_user_admin_list', 'active_routes' => [ 'admin_core_user_admin_[\w]+', ], ], [ 'name' => 'Clients', 'route' => 'admin_core_user_client_list', 'active_routes' => [ 'admin_core_user_client_[\w]+', ], ], ], ], [ 'name' => 'Groups', 'route' => 'admin_core_group_list', 'icon' => 'fa fa-users', 'active_routes' => [ 'admin_core_group_[\w]+', '_admin.group.[\w\.]', ], ], ], ]; } }

Render

To actually render the menu, just do the following from anywhere in any template:, (*6)

```html+jinja {{ renderMenu('TeacherBundle\Menu\MainMenu','sidebar') }}, (*7)


If you are defined your menu as a service, you can render as follow: ```html+jinja {{ renderMenu('my.menu.service.name','sidebar') }}

The Versions

20/03 2018

dev-master

9999999-dev

This bundle provides a menu bundle for symfony2

  Sources   Download

MIT

The Requires

 

by Daniel González Cerviño

01/06 2017

0.1.0

0.1.0.0

This bundle provides a menu bundle for symfony2

  Sources   Download

MIT

The Requires

 

by Daniel González Cerviño

25/02 2017

0.0.2

0.0.2.0

This bundle provides a menu bundle for symfony2

  Sources   Download

MIT

The Requires

 

by Daniel González Cerviño

25/02 2017

0.0.1

0.0.1.0

This bundle provides a menu bundle for symfony2

  Sources   Download

MIT

The Requires

 

by Daniel González Cerviño