Skip to content

stepapo/menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Menu

Component for Nette Framework, that helps generate menus with links and action buttons. The docs show basic example and explain ways of configurating menus.

Example

Let's create a menu with three links. Administration link is hidden for non-admins.

Definition

buttons:
    -
        label: Homepage
        destination: Home:default
    -
        label: About us
        destination: About:default
    -
        label: Administration
        destination: Admin:default
        hide: %hideAdmin%

Component

public function createComponentMainMenu()
{
    return Stepapo\Menu\UI\Menu::createFromNeon(__DIR__ . '/mainMenu.neon', [
        'hideAdmin' => !$this->user->isInRole('admin')
    ]);
}

Template

{control mainMenu}

Configuration

Menu

buttons:
    - # include Button configuration
    - # include Button configuration
actions:
    - # include Button configuration
    - # include Button configuration
templateFile:
translator:

Button

label:
destination:
parameters:
selector:
icon:
type:
confimationText:
ajax:
history:
hide:
buttons:
    - # include Button configuration
    - # include Button configuration