The module includes a dropdown trigger and menu items. Menu items can be
**link** - An link item.
**group** - A group item to create a logical grouping of menu items
for sorting purposes, and/or to create a heading.
**divider** - A dividing line.
Each item must have a unique key. If not supplied, the class will generate
one in the format: 'item*', where * is an auto incrementing number.
Keys can be used for sorting purposes and for adding links to a group.
For example, you could set the sort property to an item to array('before'=>'key1')
and it would place the item before another item with the key of 'key1'.
If you have a group with the key of 'key2', you can add to this group by
setting the key of a new item to 'key2.newItemKey'.
The sort property can also be an integer, indicating the item's position in the menu.
Here is an example menu creation:
$dropdown = new DropdownModule('my-dropdown');
$dropdown->setTrigger('A New Name')
->addLink('Link 1', '#') // automatically creates key: item1
->addDivider() // automatically creates key: item2
->addLink('Link 2', '#', 'link2', 'danger') // creates item with key: link2
->addLink('Link 3', '#') // automatically creates key: item3
->addLink('Link 4', '#') // automatically creates key: item4
->addGroup('', 'group1') // creates group with no header
->addGroup('Group 3', 'group3') // creates group with header: 'Group 3', empty so will not display
->addGroup('Group 2', 'group2') // creates group with header: 'Group 2'
->addLink('Link 5', '#', '', '', array('before', 'link2'), array('badge' => '4')) // automatically creates key: item5. Inserts before Link 2
->addLink('Link 6', '#') // automatically creates key: item6
->addLink('Link 7', '#') // automatically creates key: item7
->addLink('Link 8', '#', 'group2.link8', '', array(), array('icon' => 'flame')) // adds to Group 2
->addLink('Link 9', '#', 'group1.link9') // adds to Group 1
->addLink('Link 10', '#', 'group1.link10'); // adds to Group 1
echo $dropdown;
Which results in a menu:
Trigger Name
Link 1
------------
Link 5
Link 2
Link 3
Link 4
Link 9
Link 10
Group 2
Link 8
Link 6
Link 7