You are here

function taxonomy_menu_handler in Taxonomy menu 6.2

Same name and namespace in other branches
  1. 7 taxonomy_menu.module \taxonomy_menu_handler()

HANDLING

Parameters

$op: options are 'insert', 'update', 'delete' or path

$args: if $op == 'insert' then array with the following key/value pairs: 'term' => term object, 'menu_name' => menu that the item is set to apply to if $op == 'delete' then array( 'tid' => TermID 'mlid => Menu ID ) if $op == 'update' then 'term' => term object, 'menu_name' => menu that the item is set to apply to 'mlid' => Menu ID

5 calls to taxonomy_menu_handler()
taxonomy_menu_taxonomy in ./taxonomy_menu.module
Implementation of hook_taxonomy().
_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
_taxonomy_menu_nodeapi_helper in ./taxonomy_menu.module
Helper function to
_taxonomy_menu_update_link_items in ./taxonomy_menu.module
Update the menu items

File

./taxonomy_menu.module, line 452
It Generates menu links for all selected taxonomy terms

Code

function taxonomy_menu_handler($op, $args = array(), $item = array()) {

  // get the initial $item
  if (empty($item)) {
    $item = _taxonomy_menu_create_item($args);
  }

  // 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') {
    $depth_limit = (int) variable_get('taxonomy_menu_depth_limit_' . $args['term']->vid, 0);
    $term_parents = taxonomy_get_parents_all($args['term']->tid);
    if ($depth_limit && count($term_parents) > $depth_limit) {
      return;
    }
    return _taxonomy_menu_save($item);
  }
}