function taxonomy_menu_handler in Taxonomy menu 7
Same name and namespace in other branches
- 6.2 taxonomy_menu.module \taxonomy_menu_handler()
Taxonomy Menu Handler: Creates a menu item for each taxonomy term.
Parameters
$op: options are 'insert', 'update', 'delete' or path.
$args: if $op == 'insert' then args is an array with the following key/value pairs: 'term': taxonomy term object, 'menu_name' : menu that the item is set to apply to if $op == 'delete' then then args is an array with the following key/value pairs: 'tid': TermID 'mlid': Menu ID if $op == 'update' then then args is an array with the following key/value pairs: 'term': term object, 'menu_name': menu that the item is set to apply to 'mlid': Menu ID
$node: The node object.
$item array: Taxonomy menu item.
Return value
array Menu link ID for the taxonomy menu item.
6 calls to taxonomy_menu_handler()
- _taxonomy_menu_insert_link_items in ./
taxonomy_menu.module - Creates new link items for the vocabulary.
- _taxonomy_menu_insert_link_items_process in ./
taxonomy_menu.batch.inc - Batch operation callback function: inserts 10 menu link items.
- _taxonomy_menu_nodeapi_helper in ./
taxonomy_menu.module - Builds argument arrays calls taxonomy_menu_handler.
- _taxonomy_menu_taxonomy_termapi_helper in ./
taxonomy_menu.module - Abstraction of hook_taxonomy_term_<operation>()
- _taxonomy_menu_update_all_parents in ./
taxonomy_menu.module - Updates all parent items.
File
- ./
taxonomy_menu.module, line 610 - Adds links to taxonomy terms into a menu.
Code
function taxonomy_menu_handler($op, $args = array(), $node = NULL, $item = array()) {
// Get the initial $item.
if (empty($item)) {
$item = _taxonomy_menu_create_item($args, $node);
}
// Let other modules make edits.
$hook = 'taxonomy_menu_' . $op;
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
$function($item);
}
// Update the menu and return the mlid if the remove element is not true.
if ($op != 'delete') {
return _taxonomy_menu_save($item);
}
}