Configuring the menu

Automatic menu

BrowniePHP searchs for all models from your app and automatically creates a menu linking to each model.

Custom menu

If you want to customize the menu you can create in AppController an array called $brwMenu with the content for the menu. For example:

public $brwMenu = array(
    'Posts' => array(
        //'Button Label' => array()
        'Published' => array(
            'plugin' => 'brownie', 
            'controller' => 'contents',
            'action' => 'view', 
            'PostStatus', 
            '2',
        ),
        'Draft' => array(
            'plugin' => 'brownie', 
            'controller' => 'contents',
            'action' => 'view', 
            'PostStatus', 
            '1',
        ),
    ),
    'Configuration' => array(
        //'Button label' => 'ModelName',
        'Cateogories' => 'Category',
        'Tags' => 'Tag'
    ),
);

Will create a menu like this:

menu

In a nutshell:

  • If the link is a string will point to the list of records from that model.
  • If the link is an array will be parsed by the router as any array

You can see sample code in the demo app here


Next: Configuring models