Horde_Menu
in package
The Horde_Menu:: class provides standardized methods for creating menus in Horde applications.
Copyright 1999-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
Properties
- $_menu : array<string|int, mixed>
- Menu array.
Methods
- add() : mixed
- Add an item to the menu array.
- addArray() : mixed
- Add an item to the menu array.
- addSiteLinks() : mixed
- Add links found in the application's menu configuration.
- getSiteLinks() : array<string|int, mixed>
- Get the list of site links to add to the menu.
- isSelected() : bool
- Checks to see if the current url matches the given url.
- render() : Horde_View_Sidebar
- Return the rendered representation of the menu items.
- _render() : Horde_View_Sidebar
- Converts the menu to a sidebar view.
Properties
$_menu
Menu array.
protected
array<string|int, mixed>
$_menu
= array()
Methods
add()
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 ]) : mixed
Parameters
- $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 = null
-
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 = null
-
Onclick javascript, if desired.
- $class : string = null
-
CSS class for the menu item.
addArray()
Add an item to the menu array.
public
addArray(mixed $item) : mixed
Parameters
- $item : mixed
-
The item to add. Either a string containing the value 'separator' or an array contianing the following 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. 'container' - (string) Name of sidebar container to add to, if not the default.
addSiteLinks()
Add links found in the application's menu configuration.
public
addSiteLinks() : mixed
getSiteLinks()
Get the list of site links to add to the menu.
public
getSiteLinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of menu items to add.
isSelected()
Checks to see if the current url matches the given url.
public
static isSelected(mixed $url) : bool
Parameters
- $url : mixed
Return values
bool —Whether the given URL is the current location.
render()
Return the rendered representation of the menu items.
public
render() : Horde_View_Sidebar
Return values
Horde_View_Sidebar —Sidebar view of menu elements.
_render()
Converts the menu to a sidebar view.
protected
_render() : Horde_View_Sidebar
Return values
Horde_View_Sidebar —Sidebar view of menu elements.