\Nano4\Utils\HTMLRouterMenu

A menu generator that integrates with the Router plugin.

Summary

Methods
Properties
Constants
__construct()
buildMenu()
No public properties found
No constants found
No protected methods found
$parent
N/A
No private methods found
No private properties found
N/A

Properties

$parent

$parent : 

Type

Methods

__construct()

__construct(  $opts = array()) 

Parameters

$opts

buildMenu()

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.

Parameters

Array $menu

The menu definition.

Object $context

The RouteContext object for the request.

Array $opts

Options to change the behavior.

Returns

\Nano4\Utils\HTML\SimpleXMLElement —

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: