======Menu Helper====== ==== Summary ==== ^ Objective | Showing user and admin section menu | ^ Name | menu_helper | ^ Script | /applications/helpers/menu_helper.php | ^ Tables | setup_menu | ^ Dependency | nothing in particular | ==== What are we talking about ==== This feature is about the mechanism we use to create the user menu and the admin section menu. {{:wmanager:helper_menu.png?600|}} In WManager we have created a Codeigniter helper to dynamically handle menu from the database. Wmanager Admin side has a menu settings page where you can add new menu or change order of the menu through simple forms.In this section we see how the menu works in WManager. In WManager we populate the menu from the database. ==== How does it work ==== * The admin and front-end template includes all the css classes for the menu; * By calling in the page views: top_menu() or admin_menu() the system will provide the entries list based on roles. * Admin menu is configured using entries in setup_menu tables (having setup_menu.template='Admin'); * Top menu is configured using entries in setup_menu tables (having setup_menu.template='Wmanager'); The admin section inclides a configuration page to update **only** the Top menu entries. {{:wmanager:helper_menu_how_to_use_it.png|}} If your extension will need to add a new entry in the Admin menu you can do that by including the sql script onboard of your extension. ==== Coding detail ==== The system differentiates the menu for admin and user through the **template** field in setup_menu table.