Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stopka/nette-menu-control
Control rendering menu items
https://github.com/stopka/nette-menu-control
Last synced: about 23 hours ago
JSON representation
Control rendering menu items
- Host: GitHub
- URL: https://github.com/stopka/nette-menu-control
- Owner: Stopka
- License: gpl-3.0
- Created: 2018-01-25T18:08:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-27T10:37:06.000Z (over 5 years ago)
- Last Synced: 2024-04-06T21:40:10.428Z (7 months ago)
- Language: PHP
- Size: 34.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nette menu control
Nette control for rendering simple static menus## Instalation
Add library dependency using composer:
```bash
composer require stopka/nette-menu-control:~1.0.0
```## Usage
Register submenu factory to DI container:
```neon
services:
- Stopka\NetteMenuControl\MenuFactory
```Create your menu factory:
```php
use Stopka\NetteMenuControl\ISubmenuFactory;class MainMenuFactory {
/** @var ISubmenuFactory */
private $submenuFactory;
function __create(ISubmenuFactory $submenuFactory){
$this->submenuFactory = $submenuFactory;
}
public function create(): Menu{
$menu = $this->submenuFactory->createMenu("Home",'Homepage:default');
$menu->addSubmenu("Some item","Presenter:view");
// build menu as you need...
return $menu;
}
}
```
Register your factory also to DI Container
```neon
services:
- Stopka\NetteMenuControl\MenuFactory
- MainMenuFactory
```