100 if (is_array($menu_item)) {
105 elgg_log(
"Unable to add menu item '{$menu_item_name}' to '$menu_name' menu",
'WARNING');
111 elgg_log(
'Second argument of elgg_register_menu_item() must be an instance of ' 112 .
'ElggMenuItem or an array of menu item factory options',
'ERROR');
116 if (!isset($CONFIG->menus[$menu_name])) {
117 $CONFIG->menus[$menu_name] = array();
119 $CONFIG->menus[$menu_name][] = $menu_item;
135 if (empty($CONFIG->menus[$menu_name])) {
139 foreach ($CONFIG->menus[$menu_name] as
$index => $menu_object) {
141 if ($menu_object instanceof
ElggMenuItem && $menu_object->getName() == $item_name) {
143 unset($CONFIG->menus[$menu_name][
$index]);
163 if (!isset($CONFIG->menus[$menu_name])) {
167 foreach ($CONFIG->menus[$menu_name] as $menu_object) {
169 if ($menu_object->getName() == $item_name) {
189 if (!isset($CONFIG->menus[$menu_name])) {
193 foreach ($CONFIG->menus[$menu_name] as
$index => $menu_object) {
195 if ($menu_object->getName() == $item_name) {
196 return $CONFIG->menus[$menu_name][
$index];
230 if (!
$owner || !
$owner->canWriteToContainer(0, $entity_type, $entity_subtype)) {
236 'href' =>
"$handler/$name/$owner->guid",
238 'link_class' =>
'elgg-button elgg-button-action',
257 if (!isset($CONFIG->breadcrumbs)) {
258 $CONFIG->breadcrumbs = array();
261 $CONFIG->breadcrumbs[] = array(
'title' =>
$title,
'link' =>
$link);
273 if (empty($CONFIG->breadcrumbs) || !is_array($CONFIG->breadcrumbs)) {
276 return array_pop($CONFIG->breadcrumbs);
293 if (isset($CONFIG->breadcrumbs) && is_array($CONFIG->breadcrumbs)) {
294 $breadcrumbs = $CONFIG->breadcrumbs;
296 $breadcrumbs = array();
300 'breadcrumbs' => $breadcrumbs,
303 if (!is_array($breadcrumbs)) {
324 $last_crumb = end($breadcrumbs);
325 if (empty($last_crumb[
'link'])) {
326 array_pop($breadcrumbs);
330 foreach (array_keys($breadcrumbs) as $i) {
331 $breadcrumbs[$i][
'title'] =
elgg_get_excerpt($breadcrumbs[$i][
'title'], 100);
350 $registered =
$return[
'default'];
359 unset($registered[
$index]);
372 $return[
'default'] = $featured;
373 if (count($registered) > 0) {
378 $max_display_items = 5;
384 $return[
'more'] = array_splice(
$return[
'default'], $max_display_items);
390 foreach (
$return as $section) {
393 foreach ($section as
$item) {
394 if ($item->getSelected()) {
404 foreach (
$return as $section_name => $section) {
412 if (
$item->getHref() == $current_url) {
434 if (
$item->annotation_id == 0) {
438 'href' =>
"#comments-add-{$object->guid}-{$item->id}",
448 if (
$item->canDelete()) {
495 'href' =>
"$handler/edit/{$entity->getGUID()}",
504 $action =
"action/$handler/delete";
506 $action =
"action/entity/delete";
512 'href' =>
"$action?guid={$entity->getGUID()}",
533 'name' =>
'collapse',
535 'href' =>
"#elgg-widget-content-$widget->guid",
536 'link_class' =>
'elgg-widget-collapse-button',
547 'href' =>
"action/widgets/delete?widget_guid=$widget->guid",
549 'link_class' =>
'elgg-widget-delete-button',
550 'id' =>
"elgg-widget-delete-button-$widget->guid",
551 'data-elgg-widget-type' =>
$widget->handler,
558 'name' =>
'settings',
561 'href' =>
"#widget-edit-$widget->guid",
562 'link_class' =>
"elgg-widget-edit-button",
581 'name' =>
'register',
584 'link_class' =>
'registration_link',
589 'name' =>
'forgotpassword',
590 'href' =>
'forgotpassword',
591 'text' =>
elgg_echo(
'user:password:lost'),
592 'link_class' =>
'forgot_link',
617 'href' =>
'http://elgg.org',
626 elgg_extend_view(
'navigation/menu/elements/item',
'navigation/menu/elements/item_deps');
642 if (is_array($return_value)) {
643 $return_value[] =
'navigation/menu/user_hover/contents';
646 return $return_value;
650 $events->registerHandler(
'init',
'system',
'_elgg_nav_init');
$object
These two snippets demonstrates triggering an event and how to register for that event.
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg_view_icon($name, $vars=array())
View one of the icons.
_elgg_site_menu_setup($hook, $type, $return, $params)
Set up the site menu.
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
elgg_register_title_button($handler=null, $name= 'add', $entity_type= 'all', $entity_subtype= 'all')
Convenience function for registering a button to the title menu.
elgg_add_action_tokens_to_url($url, $html_encode=false)
Adds action tokens to URL.
_elgg_nav_init()
Navigation initialization private.
elgg_get_registration_url(array $query=[], $fragment= '')
Returns site's registration URL Triggers a 'registration_url', 'site' plugin hook that can be used by...
if($guid==elgg_get_logged_in_user_guid()) $name
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
elgg_get_menu_item($menu_name, $item_name)
Get a menu item registered for a menu.
elgg_is_menu_item_registered($menu_name, $item_name)
Check if a menu item has been registered.
elgg_action_exists($action)
Check if an action is registered and its script exists.
elgg_pop_breadcrumb()
Removes last breadcrumb entry.
_elgg_nav_public_pages($hook_name, $entity_type, $return_value, $params)
Extend public pages.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
_elgg_river_menu_setup($hook, $type, $return, $params)
Add the comment and like links to river actions menu private.
_elgg_widget_menu_setup($hook, $type, $return, $params)
Widget menu is a set of widget controls private.
elgg_in_context($context)
Check if this context exists anywhere in the stack.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
elgg_get_context()
Get the current context.
elgg_get_breadcrumbs()
Returns all breadcrumbs as an array of array('title' => 'Title', 'link' => 'URL') ...
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
elgg global
Pointer to the global context.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
elgg_register_ajax_view($view)
Register a view to be available for ajax calls.
elgg_extend_view($view, $view_extension, $priority=501)
Extends a view with another view.
_elgg_login_menu_setup($hook, $type, $return, $params)
Add the register and forgot password links to login menu private.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_log($message, $level= 'NOTICE')
Display or log a message.
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
elgg_get_version($human_readable=false)
Get the current Elgg version information.
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
elgg_unregister_menu_item($menu_name, $item_name)
Remove an item from a menu.
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
elgg_push_breadcrumb($title, $link=null)
Adds a breadcrumb to the breadcrumbs stack.
elgg_prepare_breadcrumbs($hook, $type, $breadcrumbs, $params)
Prepare breadcrumbs before display.
_elgg_entity_menu_setup($hook, $type, $return, $params)
Entity menu is list of links and info on any entity private.