2017 © Pedro Peláez
 

cakephp-plugin knp-menu

KnpMenu for CakePHP 3

image

gourmet/knp-menu

KnpMenu for CakePHP 3

  • Saturday, August 13, 2016
  • by jadb
  • Repository
  • 4 Watchers
  • 15 Stars
  • 15,924 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 2 Forks
  • 6 Open issues
  • 9 Versions
  • 9 % Grown

The README.md

KnpMenu

Build Status Total Downloads License, (*1)

Use KnpMenu with CakePHP 3., (*2)

What's included?

  • MenuComponent
  • MenuHelper

Install

Using Composer:, (*3)

composer require gourmet/knp-menu:~0.4

You then need to load the plugin. In boostrap.php, something like:, (*4)

\Cake\Core\Plugin::load('Gourmet/KnpMenu');

and add the following to your App\Controller\AppController:, (*5)

public $components = ['Gourmet/KnpMenu.Menu'];
public $helpers = ['Gourmet/KnpMenu.Menu'];

Usage

It's fairly simple. The concept is you get a menu, and you addChild to it from anywhere at anytime at the controller or view layer. At the view layer, you can also render any defined menu., (*6)

Get a menu

$menu = $this->Menu->get('my_menu');

Add child to menu

// using an array for URL and child's name as title
$menu->addChild('Dashboard', ['uri' => ['controller' => 'Users', 'action' => 'dashboard']]);
// using a named route for URL and custom title
$menu->addChild('Dashboard', ['route' => 'dashboard', 'label' => 'My Account']);

Render a menu

Only available at the view layer, (*7)

// by default, renders as a list
echo $this->Menu->render('my_menu');

Of course, you can set your own renderer (defaults to \Gourmet\KnpMenu\Menu\Renderer\ListRenderer) and matcher (defaults to \Gourmet\KnpMenu\Menu\Matcher\Matcher) by passing them as options:, (*8)

echo $this->Menu->render('my_menu', [
    'matcher' => '\Custom\Matcher',
    'renderer' => new \Custom\Renderer(...)
]);

For more, please check the official KnpMenu repo and documentation., (*9)

Patches & Features

  • Fork
  • Mod, fix
  • Test - this is important, so it's not unintentionally broken
  • Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
  • Pull request - bonus point for topic branches

Bugs & Feedback

http://github.com/gourmet/knp-menu/issues, (*10)

License

Copyright (c) 2015, Jad Bitar and licensed under The MIT License., (*11)

The Versions

13/08 2016

dev-master

9999999-dev http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp menu knp

13/08 2015

dev-4-view-changes-in-cake31

dev-4-view-changes-in-cake31 http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp menu knp

21/07 2015

v0.5.0

0.5.0.0 http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp menu knp

30/12 2014
30/12 2014

dev-revisit

dev-revisit http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp menu knp

30/12 2014
15/12 2014

0.2.1

0.2.1.0 http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

cakephp menu knp

25/09 2014

0.2.0

0.2.0.0 http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

cakephp menu knp

25/09 2014

0.1.0

0.1.0.0 http://github.com/gourmet/knp-menu

KnpMenu for CakePHP 3

  Sources   Download

MIT

The Requires

 

cakephp menu knp