Skip to content

Instantly share code, notes, and snippets.

@bhgraham
Forked from cash/elgglib.php
Created September 7, 2010 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhgraham/567829 to your computer and use it in GitHub Desktop.
Save bhgraham/567829 to your computer and use it in GitHub Desktop.
/**
* Add an item to an Elgg menu
*
* @param string $menu The name of the menu: site, page, userhover, userprofile, groupprofile, or any custom menu
* @param string $id The unique identifier for this menu item. An example is blog:add
* @param string $title The localized title string for this menu item
* @param string $url The URL for this menu item
* @param array $options An associative array of menu options including: tooltip, parent, or custom option.
* tooltip: string that is used as the title element of the link
* parent: the $id of the item's parent
*/
elgg_add_menu_item($menu, $id, $title, $url, $options) {
}
/**
* Remove an item from a menu
*
* @param string $menu The name of the menu
* @param string $id The unique identifier for this menu item
*/
elgg_remove_menu_item($menu, $id) {
}
/**
* Render a menu
*
* @param string $menu The name of the menu
* @param array $vars An associative array of display options for the menu
* @return string
*/
elgg_view_menu($menu, $vars) {
$vars['name'] = $menu;
// sort menu and determine selected item
menu object/array = trigger_plugin_hook('prepare', 'menu', menu object/array, $vars);
if (elgg_view_exists("navigation/menu/$menu")) {
return elgg_view("navigation/menu/$menu", $vars);
} else {
return elgg_view("navigation/menu/default", $vars);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment