Menu¶
-
class
phpctrl\ui\
Menu
¶
Menu implements horizontal or vertical multi-level menu by using Semantic UI’s ‘menu’.
Using Menu¶
Here is a simple usage:
$menu = $layout->add('Menu');
$menu->addItem('foo');
$menu->addItem('bar');
to make menu vertical:
$menu->addClass('vertical');
Specifying Links and Actions¶
Menu items can use links and actions:
$menu->addItem('foo', 'test.php');
$menu->addItem('bar', new jsModal('Test'));
Creating sub-menus¶
You can create sub-menu for either vertical or horizontal menu. For a vertical menu you can also use groups. For horizontal menu, you can use addRightMenu.
$menu = $layout->add('Menu');
$menu->addItem('foo');
$sub = $menu->addMenu('Some Bars');
$sub->addItem('bar 1');
$sub->addItem('bar 2');
Headers¶
Advanced Use¶
You can add other elements inside menu. Refer to demos/menu.php.
Item¶
-
class
phpctrl\ui\
Item
¶
-
property
phpctrl\ui\Item::$
$label
¶
Additionally you can use View::addClass()
to disable or style your menu items.