Component for Nette Framework, that helps generate menus with links and action buttons. The docs show basic example and explain ways of configurating menus.
Let's create a menu with three links. Administration link is hidden for non-admins.
buttons:
-
label: Homepage
destination: Home:default
-
label: About us
destination: About:default
-
label: Administration
destination: Admin:default
hide: %hideAdmin%
public function createComponentMainMenu()
{
return Stepapo\Menu\UI\Menu::createFromNeon(__DIR__ . '/mainMenu.neon', [
'hideAdmin' => !$this->user->isInRole('admin')
]);
}
{control mainMenu}
buttons:
- # include Button configuration
- # include Button configuration
actions:
- # include Button configuration
- # include Button configuration
templateFile:
translator:
label:
destination:
parameters:
selector:
icon:
type:
confimationText:
ajax:
history:
hide:
buttons:
- # include Button configuration
- # include Button configuration