dereuromark/cakephp-menu
Composer 安装命令:
composer require dereuromark/cakephp-menu
包简介
Composable menu builder and renderer for CakePHP
README 文档
README
Composable menu builder and renderer for CakePHP applications.
This branch is for CakePHP 5.3+. See the version map for details.
Features:
- nested menu trees with string and Cake-style array URLs
- active-state matching with alternate routes, named routes, and fuzzy matching
- helper-managed named menus and breadcrumb integration
- extensible resolvers and renderers for app-specific rules
Installation
composer require dereuromark/cakephp-menu
Load the plugin:
bin/cake plugin load Menu
Load the helper in your AppView:
use Cake\View\View; class AppView extends View { public function initialize(): void { parent::initialize(); $this->loadHelper('Menu.Menu'); } }
Quick Start
use Menu\Menu; $menu = Menu::create(['class' => 'nav']); $menu->addItem('Dashboard', ['controller' => 'Dashboard', 'action' => 'index']); $account = $menu->addItem('Account', '#', [ 'attributes' => ['class' => 'nav-item'], ]); $account->getSubMenu()->setAttributes(['class' => 'submenu']); $account->add($menu->newItem('Profile', ['controller' => 'Users', 'action' => 'profile'])); $account->add($menu->newItem('Logout', ['controller' => 'Users', 'action' => 'logout'])); echo $this->Menu->render($menu);
Documentation
Full documentation lives at https://dereuromark.github.io/cakephp-menu/.
Demo
统计信息
- 总下载量: 3.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-21