t4web/navigation
最新稳定版本:1.0.5
Composer 安装命令:
composer require t4web/navigation
包简介
ZF2 Module which simplifies creationiewing menus
关键字:
README 文档
README
ZF2 Module which simplifies creating and viewing menus
Usage
Add Navigation repo in yours require in composer.json:
"repositories": [ { "type": "git", "url": "https://github.com/t4web/navigation.git" } ], "require": { "t4web/navigation": "dev-master" }
In your project, for example in modules/Application/Module.php, you can add Navigation service:
'factories' => array( 'UserNavigation' => function (ServiceLocatorInterface $sl) { $factory = new T4webNavigation\Factory(); return $factory->createService($sl); }, )
In your BootstrapListener you can add menu entries:
public function onBootstrap(EventInterface $e) { $sl = $e->getApplication()->getServiceLocator(); $navigarot = $sl->get('T4webNavigation\Menu\Navigator'); $navigator->addEntry('Dashboard', 'home', 'fa fa-dashboard'); $navigator->addEntry('Employees', 'employees-list', 'fa fa-users'); $navigator->addEntry(TITLE, ROUTE, ENTRY_ICON_CLASS); }
where TITLE - title in meny entry, ROUTE - route from module config, ENTRY_ICON_CLASS - class for <i> tag.
After this you can add in your layout menu rendering:
<?= $this->navigation('UserNavigation') ->menu()->setUlClass('navigation') ->setPartial('navigation'); ?>
will be render:
<ul class="navigation"> <li> <a href="/"><i class="fa fa-dashboard"></i><span class="mm-text">Dashboard</span></a> </li> <li class="active"> <a href="/employees"><i class="fa fa-users"></i><span class="mm-text">Employees</span></a> </li> </ul>
For customizing menu you can copy partial from vendor/t4web/navigation/view/partials/navigation.phtml to your module and modify it.
统计信息
- 总下载量: 127
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-10-24