$parent
$parent :
A menu generator that integrates with the Router plugin.
buildMenu(Array $menu, Object $context, Array $opts = array()) : \Nano4\Utils\HTML\SimpleXMLElement
Build a menu.
Given some information and a menu definition, this will generate an HTML menu using a specific layout.
| Array | $menu | The menu definition. |
| Object | $context | The RouteContext object for the request. |
| Array | $opts | Options to change the behavior. |
An HTML structure representing the menu.
Menu Formats
There are a few accepted menu formats. We detect them automatically as we build the menu.
If you use a flat (non-associative) array, then you will need to supply the 'route' and 'name' parameters within the item definition (which is an associative array).
Otherwise, if the menu itself is an associate array, the key will be used as the 'url' or 'name' tags if one or both of them is missing, but only if it is a string.
Options
root A SimpleXMLElement object, or an HTML string. This represents the menu root object. Default:
itemel If specified, menu items will be wrapped in this container, and any applicable CSS classes will be applied to it. If not specified, items are added as tags directly.
show A list of show rules. Show rules can be applied to menu items, and can be closures or callables that return true or false, or can be a value that must match in the menu item definition.
classname The class name for the "current" menu item.
builders Menu items that are actually generated by a closure or callable that is passed the menu XML object.
handlers Menu items can be passed to closures/callables that will can apply classes or perform other manipulations.