Horde_Menu::add PHP Method

add() public method

Add an item to the menu array.
public add ( string $url, string $text, string $icon = '', string $icon_path = null, string $target = '', string $onclick = null, string $class = null )
$url string String containing the value for the hyperlink.
$text string String containing the label for this menu item.
$icon string String containing the filename of the image icon to display for this menu item.
$icon_path string If the icon lives in a non-default directory, where is it?
$target string If the link needs to open in another frame or window, what is its name?
$onclick string Onclick javascript, if desired.
$class string CSS class for the menu item.
    public function add($url, $text, $icon = '', $icon_path = null, $target = '', $onclick = null, $class = null)
    {
        $this->_menu[] = array('url' => $url instanceof Horde_Url ? $url : new Horde_Url($url), 'text' => $text, 'icon' => $icon, 'icon_path' => $icon_path, 'target' => $target, 'onclick' => $onclick, 'class' => $class);
    }

Usage Example

示例#1
0
 /**
  * @param Horde_Menu  $menu  A menu object
  */
 public function menu($menu)
 {
     global $conf, $injector;
     if (empty($this->highlight) && basename($_SERVER['PHP_SELF']) == 'index.php') {
         $this->highlight = 'sesha-list';
     }
     $menu->add(Horde::url('list.php'), _("_List Stock"), 'sesha-list', null, null, null, $this->highlight == 'sesha-list' ? 'current' : null);
     /* Search. */
     $menu->add(Horde::url('search.php'), _("_Search"), 'sesha-search', null, null, null, $this->highlight == 'sesha-search' ? 'current' : null);
     if (Sesha::isAdmin(Horde_Perms::READ) || $perms->hasPermission('sesha:addStock', $GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         $menu->add(Horde::url('admin.php'), _("Administration"), 'sesha-admin');
     }
 }
All Usage Examples Of Horde_Menu::add