[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/includes/ -> menu.inc (summary)

(no description)

File Size: 2551 lines (90 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 69 functions

  menu_get_ancestors()
  menu_unserialize()
  menu_set_item()
  menu_get_item()
  menu_execute_active_handler()
  _menu_load_objects()
  _menu_check_access()
  _menu_item_localize()
  _menu_translate()
  _menu_link_map_translate()
  menu_tail_to_arg()
  _menu_link_translate()
  menu_get_object()
  menu_tree()
  menu_tree_output()
  menu_tree_all_data()
  menu_tree_page_data()
  _menu_tree_cid()
  menu_tree_collect_node_links()
  menu_tree_check_access()
  _menu_tree_check_access()
  menu_tree_data()
  _menu_tree_data()
  theme_menu_item_link()
  theme_menu_tree()
  theme_menu_item()
  theme_menu_local_task()
  drupal_help_arg()
  menu_get_active_help()
  menu_get_names()
  menu_list_system_menus()
  menu_primary_links()
  menu_secondary_links()
  menu_navigation_links()
  menu_local_tasks()
  menu_primary_local_tasks()
  menu_secondary_local_tasks()
  menu_tab_root_path()
  theme_menu_local_tasks()
  menu_set_active_menu_name()
  menu_get_active_menu_name()
  menu_set_active_item()
  menu_set_active_trail()
  menu_get_active_trail()
  menu_get_active_breadcrumb()
  menu_get_active_title()
  menu_link_load()
  menu_cache_clear()
  menu_cache_clear_all()
  menu_rebuild()
  menu_router_build()
  _menu_router_cache()
  _menu_link_build()
  _menu_navigation_links_rebuild()
  menu_link_delete()
  _menu_delete_item()
  menu_link_save()
  _menu_clear_page_cache()
  _menu_set_expanded_menus()
  _menu_find_router_path()
  menu_link_maintain()
  menu_link_children_relative_depth()
  _menu_link_move_children()
  _menu_update_parental_status()
  _menu_link_parents_set()
  _menu_router_build()
  menu_path_is_external()
  _menu_site_is_offline()
  menu_valid_path()

Functions
Functions that are not part of a class:

menu_get_ancestors($parts)   X-Ref
Returns the ancestors (and relevant placeholders) for any given path.

For example, the ancestors of node/12345/edit are:
- node/12345/edit
- node/12345/%
- node/%/edit
- node/%/%
- node/12345
- node/%
- node

To generate these, we will use binary numbers. Each bit represents a
part of the path. If the bit is 1, then it represents the original
value while 0 means wildcard. If the path is node/12/edit/foo
then the 1011 bitstring represents node/%/edit/foo where % means that
any argument matches that part.  We limit ourselves to using binary
numbers that correspond the patterns of wildcards of router items that
actually exists.  This list of 'masks' is built in menu_rebuild().

param: $parts
return:

menu_unserialize($data, $map)   X-Ref
The menu system uses serialized arrays stored in the database for
arguments. However, often these need to change according to the
current path. This function unserializes such an array and does the
necessary change.

Integer values are mapped according to the $map parameter. For
example, if unserialize($data) is array('view', 1) and $map is
array('node', '12345') then 'view' will not be changed because
it is not an integer, but 1 will as it is an integer. As $map[1]
is '12345', 1 will be replaced with '12345'. So the result will
be array('node_load', '12345').

param: @data
param: @map
return:

menu_set_item($path, $router_item)   X-Ref
Replaces the statically cached item for a given path.

param: $path
param: $router_item

menu_get_item($path = NULL, $router_item = NULL)   X-Ref
Get a router item.

param: $path
param: $router_item
return:

menu_execute_active_handler($path = NULL)   X-Ref
Execute the page callback associated with the current path


_menu_load_objects(&$item, &$map)   X-Ref
Loads objects into the map as defined in the $item['load_functions'].

param: $item
param: $map
return:

_menu_check_access(&$item, $map)   X-Ref
Check access to a menu item using the access callback

param: $item
param: $map
return:

_menu_item_localize(&$item, $map, $link_translate = FALSE)   X-Ref
Localize the router item title using t() or another callback.

Translate the title and description to allow storage of English title
strings in the database, yet display of them in the language required
by the current user.

param: $item
param: $map
param: $link_translate
return:

_menu_translate(&$router_item, $map, $to_arg = FALSE)   X-Ref
Handles dynamic path translation and menu access control.

When a user arrives on a page such as node/5, this function determines
what "5" corresponds to, by inspecting the page's menu path definition,
node/%node. This will call node_load(5) to load the corresponding node
object.

It also works in reverse, to allow the display of tabs and menu items which
contain these dynamic arguments, translating node/%node to node/5.

Translation of menu item titles and descriptions are done here to
allow for storage of English strings in the database, and translation
to the language required to generate the current page

param: $router_item
param: $map
param: $to_arg
return:

_menu_link_map_translate(&$map, $to_arg_functions)   X-Ref
This function translates the path elements in the map using any to_arg
helper function. These functions take an argument and return an object.
See http://drupal.org/node/109153 for more information.

param: map
param: $to_arg_functions

menu_tail_to_arg($arg, $map, $index)   X-Ref
No description

_menu_link_translate(&$item)   X-Ref
This function is similar to _menu_translate() but does link-specific
preparation such as always calling to_arg functions.

param: $item
return:

menu_get_object($type = 'node', $position = 1, $path = NULL)   X-Ref
Get a loaded object from a router item.

menu_get_object() will provide you the current node on paths like node/5,
node/5/revisions/48 etc. menu_get_object('user') will give you the user
account on user/5 etc. Note - this function should never be called within a
_to_arg function (like user_current_to_arg()) since this may result in an
infinite recursion.

param: $type
param: $position
param: $path

menu_tree($menu_name = 'navigation')   X-Ref
Render a menu tree based on the current path.

The tree is expanded based on the current path and dynamic paths are also
changed according to the defined to_arg functions (for example the 'My account'
link is changed from user/% to a link with the current user's uid).

param: $menu_name
return:

menu_tree_output($tree)   X-Ref
Returns a rendered menu tree.

param: $tree
return:

menu_tree_all_data($menu_name = 'navigation', $item = NULL)   X-Ref
Get the data structure representing a named menu tree.

Since this can be the full tree including hidden items, the data returned
may be used for generating an an admin interface or a select.

param: $menu_name
param: $item
return:

menu_tree_page_data($menu_name = 'navigation')   X-Ref
Get the data structure representing a named menu tree, based on the current page.

The tree order is maintained by storing each parent in an individual
field, see http://drupal.org/node/141866 for more.

param: $menu_name
return:

_menu_tree_cid($menu_name, $data)   X-Ref
Helper function - compute the real cache ID for menu tree data.


menu_tree_collect_node_links(&$tree, &$node_links)   X-Ref
Recursive helper function - collect node links.

param: $tree
param: $node_links

menu_tree_check_access(&$tree, $node_links = array()   X-Ref
Check access and perform other dynamic operations for each link in the tree.

param: $tree
param: $node_links

_menu_tree_check_access(&$tree)   X-Ref
Recursive helper function for menu_tree_check_access()


menu_tree_data($result = NULL, $parents = array()   X-Ref
Build the data representing a menu tree.

param: $result
param: $parents
param: $depth
return:

_menu_tree_data($result, $parents, $depth, $previous_element = '')   X-Ref
Recursive helper function to build the data representing a menu tree.

The function is a bit complex because the rendering of an item depends on
the next menu item. So we are always rendering the element previously
processed not the current one.

theme_menu_item_link($link)   X-Ref
Generate the HTML output for a single menu link.


theme_menu_tree($tree)   X-Ref
Generate the HTML output for a menu tree


theme_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL)   X-Ref
Generate the HTML output for a menu item and submenu.


theme_menu_local_task($link, $active = FALSE)   X-Ref
Generate the HTML output for a single local task link.


drupal_help_arg($arg = array()   X-Ref
Generates elements for the $arg array in the help hook.


menu_get_active_help()   X-Ref
Returns the help associated with the active menu item.


menu_get_names($reset = FALSE)   X-Ref
Build a list of named menus.


menu_list_system_menus()   X-Ref
Return an array containing the names of system-defined (default) menus.


menu_primary_links()   X-Ref
Return an array of links to be rendered as the Primary links.


menu_secondary_links()   X-Ref
Return an array of links to be rendered as the Secondary links.


menu_navigation_links($menu_name, $level = 0)   X-Ref
Return an array of links for a navigation menu.

param: $menu_name
param: $level
return:

menu_local_tasks($level = 0, $return_root = FALSE)   X-Ref
Collects the local tasks (tabs) for a given level.

param: $level
param: $return_root
return:

menu_primary_local_tasks()   X-Ref
Returns the rendered local tasks at the top level.


menu_secondary_local_tasks()   X-Ref
Returns the rendered local tasks at the second level.


menu_tab_root_path()   X-Ref
Returns the router path, or the path of the parent tab of a default local task.


theme_menu_local_tasks()   X-Ref
Returns the rendered local tasks. The default implementation renders them as tabs.


menu_set_active_menu_name($menu_name = NULL)   X-Ref
Set (or get) the active menu for the current page - determines the active trail.


menu_get_active_menu_name()   X-Ref
Get the active menu for the current page - determines the active trail.


menu_set_active_item($path)   X-Ref
Set the active path, which determines which page is loaded.

param: $path

menu_set_active_trail($new_trail = NULL)   X-Ref
Sets or gets the active trail (path to root menu root) of the current page.

param: $new_trail
return:

menu_get_active_trail()   X-Ref
Gets the active trail (path to root menu root) of the current page.

See menu_set_active_trail() for details of return value.

menu_get_active_breadcrumb()   X-Ref
Get the breadcrumb for the current page, as determined by the active trail.


menu_get_active_title()   X-Ref
Get the title of the current page, as determined by the active trail.


menu_link_load($mlid)   X-Ref
Get a menu link by its mlid, access checked and link translated for rendering.

This function should never be called from within node_load() or any other
function used as a menu object load function since an infinite recursion may
occur.

param: $mlid
return:

menu_cache_clear($menu_name = 'navigation')   X-Ref
Clears the cached cached data for a single named menu.


menu_cache_clear_all()   X-Ref
Clears all cached menu data.  This should be called any time broad changes
might have been made to the router items or menu links.


menu_rebuild()   X-Ref
(Re)populate the database tables used by various menu functions.

This function will clear and populate the {menu_router} table, add entries
to {menu_links} for new router items, then remove stale items from
{menu_links}. If called from update.php or install.php, it will also
schedule a call to itself on the first real page load from
menu_execute_active_handler(), because the maintenance page environment
is different and leaves stale data in the menu tables.

menu_router_build($reset = FALSE)   X-Ref
Collect, alter and store the menu definitions.


_menu_router_cache($new_menu = NULL)   X-Ref
Helper function to store the menu router if we have it in memory.


_menu_link_build($item)   X-Ref
Builds a link from a router item.


_menu_navigation_links_rebuild($menu)   X-Ref
Helper function to build menu links for the items in the menu router.


menu_link_delete($mlid, $path = NULL)   X-Ref
Delete one or several menu links.

param: $mlid
param: $path

_menu_delete_item($item, $force = FALSE)   X-Ref
Helper function for menu_link_delete; deletes a single menu link.

param: $item
param: $force

menu_link_save(&$item)   X-Ref
Save a menu link.

param: $item
return:

_menu_clear_page_cache()   X-Ref
Helper function to clear the page and block caches at most twice per page load.


_menu_set_expanded_menus()   X-Ref
Helper function to update a list of menus with expanded items


_menu_find_router_path($link_path)   X-Ref
Find the router path which will serve this path.

param: $link_path
return:

menu_link_maintain($module, $op, $link_path, $link_title)   X-Ref
Insert, update or delete an uncustomized menu link related to a module.

param: $module
param: $op
param: $link_path
param: $link_title
return:

menu_link_children_relative_depth($item)   X-Ref
Find the depth of an item's children relative to its depth.

For example, if the item has a depth of 2, and the maximum of any child in
the menu link tree is 5, the relative depth is 3.

param: $item
return:

_menu_link_move_children($item, $existing_item)   X-Ref
Update the children of a menu link that's being moved.

The menu name, parents (p1 - p6), and depth are updated for all children of
the link, and the has_children status of the previous parent is updated.

_menu_update_parental_status($item, $exclude = FALSE)   X-Ref
Check and update the has_children status for the parent of a link.


_menu_link_parents_set(&$item, $parent)   X-Ref
Helper function that sets the p1..p9 values for a menu link being saved.


_menu_router_build($callbacks)   X-Ref
Helper function to build the router table based on the data from hook_menu.


menu_path_is_external($path)   X-Ref
Returns TRUE if a path is external (e.g. http://example.com).


_menu_site_is_offline()   X-Ref
Checks whether the site is off-line for maintenance.

This function will log the current user out and redirect to front page
if the current user has no 'administer site configuration' permission.

return:

menu_valid_path($form_item)   X-Ref
Validates the path of a menu link being created or edited.

return:



Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7