MenuEntry - viames/pair GitHub Wiki
Pair framework: MenuEntry
Pair\Html\MenuEntry is the final value object used by Menu renderers.
When to use
Use it indirectly through Menu/BootstrapMenu. In most applications you do not instantiate it manually.
Main behavior
- Represents one node (label, URL, state, nesting metadata).
- Serves as stable render input for menu classes.
Implementation examples
Through Menu
$menu = new \Pair\Html\Menu();
$menu->add('Dashboard', '/dashboard');
$menu->add('Orders', '/orders');
$entries = $menu->getEntries();
// each item is a MenuEntry
Through BootstrapMenu
$menu = new \Pair\Html\BootstrapMenu();
$menu->add('Home', '/');
$menu->add('Products', '/products');
echo $menu->render();
Common pitfalls
- Treating
MenuEntryas mutable business data instead of presentation data.
See also: Menu, BootstrapMenu, Breadcrumb.