Skip to content

MenuEntry

Viames Marino edited this page Feb 23, 2026 · 1 revision

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 MenuEntry as mutable business data instead of presentation data.

See also: Menu, BootstrapMenu, Breadcrumb.

Clone this wiki locally