public addArray ( array $item ) : integer | ||
$item | array | The item to add. Valid keys:
'class' - (string) CSS classname. 'icon' - (string) Filename of the image icon. 'icon_path' - (string) Non-default directory path for icon. 'onclick' - (string) Onclick javascript. 'target' - (string) HREF target parameter. 'text' - (string) Label. 'url' - (string) Hyperlink. |
return | integer | The id (NOT guaranteed to be an array index) of the item just added to the menu. |
public function addArray($item)
{
if (!isset($item['url'])) {
$item['url'] = new Horde_Url();
} elseif (!$item['url'] instanceof Horde_Url) {
$item['url'] = new Horde_Url($item['url']);
}
$this->_menu[] = array_merge(array('class' => null, 'icon' => '', 'icon_path' => null, 'onclick' => null, 'target' => '', 'text' => ''), $item);
}
function getMenu($returnType = 'object') { global $registry; $menu = new Horde_Menu(); $menu->addArray(array('url' => Horde::url('summary.php'), 'text' => _("Summary"), 'icon' => 'fax.png')); $menu->addArray(array('url' => Horde::url('folder.php'), 'text' => _("Folders"), 'icon' => 'folder.png')); $menu->addArray(array('url' => Horde::url('compose.php'), 'text' => _("Compose"), 'icon' => 'compose.png')); if ($returnType == 'object') { return $menu; } else { return $menu->render(); } }