Menu service.
Class Menu( [instance] ) from \ Service(( instance))
instance | An instance name for this service. |
This service is used to manage static and dynamic web site menus.
Menus are a set of links, associated with a string to identify them, that can be shown or optionally hidden if the incoming user level is not high enough to grant him with some option.
The base menu can be configured through the Menu.items configuration, which must be an array of MenuItem variables.
The Skin of this serivce will render the menu as a whole, while a subskin called mi_skin is called to render each single item. The default skins will render sub-menus recursively; you may implement a different strategy by reimplementing the default skin or the item_skin subskin, or both.
Other services can dynamically register new items through the the add_menu hook, or in case this service has an instance name, on add_menu.
Nest.emit( "add_menu[.<instance>]", MenuItem(...) [, "parent" ] )
where the optional parent is a string indicating an MenuItem.text property in a toplevel item. Deeper submenu parents may be reached using "level1.level2...." dot separator between items.
Submenus added this way are pushed at the end of the already registered menus at the same level. If more complex interaction is required, the Menu.items service variable can be subscribed and manipulated directly.