-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing menu documentation, resolve #96
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
.. _menu: | ||
|
||
==== | ||
Menu | ||
==== | ||
|
||
.. php:namespace:: atk4\ui | ||
.. php:class:: Menu | ||
Menu implements horizontal or vertical multi-level menu by using Semantic UI's 'menu'. | ||
|
||
Using Menu | ||
========== | ||
|
||
.. php:method: addItem($label, $action) | ||
Here is a simple usage:: | ||
|
||
$menu = $layout->add('Menu'); | ||
$menu->addItem('foo'); | ||
$menu->addItem('bar'); | ||
|
||
to make menu vertical:: | ||
|
||
$menu->addClass('vertical'); | ||
|
||
|
||
Decorating Menu Items | ||
===================== | ||
|
||
See :php:class:`Item` for more options:: | ||
|
||
$menu->addItem(['foo', 'icon'=>'book']); | ||
|
||
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 | ||
================== | ||
|
||
.. php:method: addMenu($label) | ||
.. php:method: addGroup($label) | ||
.. php:method: addRightMenu($label) | ||
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 | ||
======= | ||
|
||
.. php:method: addHeader($label) | ||
Advanced Use | ||
============ | ||
|
||
You can add other elements inside menu. Refer to demos/menu.php. | ||
|
||
Item | ||
==== | ||
|
||
.. php:class:: Item | ||
.. php:attr:: $label | ||
.. php::attr:: $icon | ||
Additionally you can use :php:meth:`View::addClass()` to disable or style your menu items. |