2017 © Pedro Peláez
 

symfony-bundle config-knp-menu-bundle

Fork of jbouzekri/ConfigKnpMenuBundle

image

firestorm23/config-knp-menu-bundle

Fork of jbouzekri/ConfigKnpMenuBundle

  • Wednesday, January 6, 2016
  • by firestorm23
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

ConfigKnpMenuBundle

Build Status, (*1)

Introduction

This bundle provides a way to configure your knp menus in your bundles yml configuration., (*2)

For more information on knp menu, read : * The Knp Menu Documentation * The Knp Menu Bundle Documentation, (*3)

This bundle was inspired by the OroNavigationBundle in oro crm., (*4)

Installation

You can use composer for installation., (*5)

Add the repository to the composer.json file of your project and run the update or install command., (*6)

``` json { "require": { "jbouzekri/config-knp-menu-bundle": "3.0.0" } }, (*7)


Then enable it in your AppKernel.php with the KnpMenuBundle : ``` php $bundles = array( ... new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Jb\Bundle\ConfigKnpMenuBundle\JbConfigKnpMenuBundle(), );

Documentation

In order to use this bundle, you must define your menu configuration in a navigation.yml file in your bundle., (*8)

Example : ``` yml my_mega_menu: tree: first_level_item: label: My first label children: second_level_item: label: My second level, (*9)


It will configure a provider for knp menu factory. You can then use your my_mega_menu in twig as a classic knp menu : ``` twig {{ knp_menu_render('my_mega_menu') }}

Configuration

This is the available configuration definition for an item., (*10)

yml my_mega_menu: childrenAttributes: An array of attributes passed to the root ul tag tree: first_level_item: uri: "An uri. Use it if you do not define route parameter" route: "A sf2 route without @" routeParameters: "an array of parameters to pass to the route" label: "My first label" order: An integer to sort the item in his level. attributes: An array of attributes passed to the knp item linkAttributes: An array of attributes passed to the a tag childrenAttributes: An array of attributes passed to the chidlren block labelAttributes: An array of attributes passed to the label tag display: boolean to hide the item displayChildren: boolean to hide the children roles: array of item (string roles) passed to isGranted securityContext method to check if user has rights in menu items children: # An array of subitems second_level_item: label: My second level, (*11)

This configuration matches the methods available in the Knp Menu Item class, (*12)

Security context is injected in menu item provider., (*13)

For root menu item, display or hide it in your twig template. For children items, if you didn't add the roles key, they will be displayed. Else it will passed the array of key to the isGranted method and check if you have rights on the the item., (*14)

Issues

  • tree sub configuration property : In the navigation.yml file, you must defined a tree key below your menu name. It provides another level to keep the first level item key after configuration parsing. If someone know how to remove it, let me know.

The Versions

06/01 2016

dev-master

9999999-dev https://github.com/firestorm23/ConfigKnpMenuBundle

Fork of jbouzekri/ConfigKnpMenuBundle

  Sources   Download

MIT

The Requires

 

ui symfony navigation menu user interface knp

24/10 2014

3.0.0

3.0.0.0 https://github.com/jbouzekri/ConfigKnpMenuBundle

Configure your knp menus with yaml files accross your project bundles

  Sources   Download

MIT

The Requires

 

ui symfony navigation menu user interface knp

20/08 2014

2.0.0

2.0.0.0 https://github.com/jbouzekri/ConfigKnpMenuBundle

Configure your knp menus with yaml files accross your project bundles

  Sources   Download

MIT

The Requires

 

ui symfony navigation menu user interface knp

09/07 2014

1.0.1

1.0.1.0 https://github.com/jbouzekri/ConfigKnpMenuBundle

Configure your knp menus with yaml files accross your project bundles

  Sources   Download

MIT

The Requires

 

ui symfony navigation menu user interface knp

17/05 2014

1.0.0

1.0.0.0 https://github.com/jbouzekri/ConfigKnpMenuBundle

Configure your knp menus with yaml files accross your project bundles

  Sources   Download

MIT

The Requires

 

ui symfony navigation menu user interface knp