flame / navbarbuilder-component
Nette Framework component for simple building of navigation (used TwitterBootstrap)
dev-master
2013-02-28 22:14 UTC
Requires
- php: >=5.3.2
- flame/framework: dev-master
- nette/nette: dev-master
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-12-21 14:07:08 UTC
README
About
Nette Framework component for simple building of navigation (used TwitterBootstrap)
Installation
Preferred way of installation is using Composer.
Add the following dependency to your composer.json
file and you're ready to go.
{ "require": { "flame/navbarbuilder-component": "@dev" } }
Usage
###In config.neon
factories:
navbarBuilderControl:
implement: \Flame\Components\NavbarBuilder\INavbarBuilderControlFactory
...
###In base presenter
/** * @autowire * @var \Flame\Components\NavbarBuilder\INavbarBuilderControlFactory */ protected $navbarBuilderControlFactory; /** * @return \Flame\Components\NavbarBuilder\NavbarBuilderControl */ protected function createComponentNavbarBuilder() { $control = $this->navbarBuilderControlFactory->create(); $control->setTitle('Dashboard', 'Dashboard:'); $navbar = $control->getNavbarControl(); $navbar->addItem('Posts', 'Post:'); $navbar->addItem('List', 'Post:', 'Posts'); $navbar->addItem('Import', 'Import:', 'Posts', true); $navbar->addItem('Comments', 'Comment:', 'Posts'); $navbar->addItem('Newsreel', 'Newsreel:'); $navbar->addItem('Images', 'Image:'); $userbar = $control->getUserbarControl(); $userbar->addItem('Account settings', 'User:edit'); $userbar->addItem('Password edit', 'User:password'); $userbar->setUserName($this->getUser()->getIdentity()); return $control; }
###In template (e.g. @layout.latte)
{control navbarBuilder}