2017 © Pedro Peláez
 

symfony-bundle menu-bundle

Simple Object oriented menus for Symfony.

image

eschmar/menu-bundle

Simple Object oriented menus for Symfony.

  • Monday, January 16, 2017
  • by eschmar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 121 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

Eschmar Menu Bundle

Simple Object oriented menus for Symfony with role permissions., (*1)

Installation

Composer (Packagist):, (*2)

composer require eschmar/menu-bundle ^1.0.0 # Symfony 4

See eschmar/menu-bundle ^0.2.0 for Symfony 3., (*3)

Usage

Create a new <Name>Menu class extending the AbstractMenu for each of your menus in your App\Menu namespace:, (*4)

namespace App\Menu;

use Eschmar\MenuBundle\Menu\AbstractMenu;

class TestMenu extends AbstractMenu
{
    public function generateMenu()
    {
        // create root node
        $this->root = $this->newNode('Navigation');

        // append a new node for each navigation element
        $this->root->node('Link 1');
        $this->root->node('Link 2');
        $this->root->node('Link 3');

        // multi-dimensional
        $this->root['Link 2']->node('Sublink 1');
        $this->root['Link 2']['Sublink 1']->node('Subsublink 1');

        // generate route
        $this->root['Link 3']->node('Sublink 3', null, 'acme_hello_homepage');

        // role permissions
        $this->root['Link 3']->node('Sublink 2', null, null, 'ROLE_ADMIN', array());
    }

} // END class TestMenu

Render the menu directly in twig: ````Twig {{ menu('TestMenu') }}, (*5)

{# override template #} {{ menu('TestMenu', 'test/mobile.html.twig') }} ```, (*6)

License

MIT License., (*7)

The Versions

16/01 2017

dev-master

9999999-dev https://github.com/eschmar/menu-bundle

Simple Object oriented menus for Symfony.

  Sources   Download

MIT

The Requires

 

symfony menu

31/10 2016

v0.2.0

0.2.0.0 https://github.com/eschmar/menu-bundle

Simple Object oriented menus for Symfony.

  Sources   Download

MIT

The Requires

 

symfony menu

13/12 2014

v0.1.0

0.1.0.0 https://github.com/eschmar/menu-bundle

Simple Object oriented menus for Symfony.

  Sources   Download

MIT

The Requires

 

symfony menu