Skip to content

BootstrapMenu

Viames Marino edited this page Oct 19, 2026 · 2 revisions

Pair framework: BootstrapMenu

Pair\Html\BootstrapMenu extends Menu with Bootstrap-oriented rendering helpers.

Main behavior

Protected rendering methods:

  • renderDropdown(MenuEntry $entry): string
  • renderSeparator(MenuEntry $entry): string
  • renderSingle(MenuEntry $entry): string

Implementation example

use Pair\Html\BootstrapMenu;

$menu = new BootstrapMenu();
$menu->item('dashboard/default', 'Home', 'fa-house');
$menu->item('products/default', 'Products', 'fa-box');

echo $menu->render();

Notes

  • Uses MenuEntry objects to represent nodes.
  • Designed for Bootstrap HTML class conventions.
  • Uses the inherited Menu::item($url, $title, ...) and group(...) builders; there is no add() method.
  • render() returns entry markup. Supply the enclosing list and the application's matching CSS/JavaScript in the layout; constructing this class does not load Bootstrap or switch UiTheme.

See also: Menu, MenuEntry.

Clone this wiki locally