You are here

function taxonomy_menu_menu_link_save in Taxonomy menu 7.2

Same name and namespace in other branches
  1. 8 taxonomy_menu.module \taxonomy_menu_menu_link_save()

Saves a menu link in a menu, based on a taxonomy term.

Parameters

$term: A taxonomy term used to save a respective menu item.

$menu_name: The machine name of the menu in which the menu link should be saved.

Return value

The menu link ID of the menu item that has been saved. FALSE, if no item could be saved.

2 calls to taxonomy_menu_menu_link_save()
_taxonomy_menu_save_menu_links_process in ./taxonomy_menu.batch.inc
Processes the batch.
_taxonomy_menu_termapi_helper in ./taxonomy_menu.module
Abstraction of hook_termapi_<op>().

File

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

Code

function taxonomy_menu_menu_link_save($term, $menu_name) {

  // Prepare a menu link based on the settings of the vocabulary edit page and
  // save it.
  $menu_link = taxonomy_menu_menu_link_prepare($term, $menu_name);
  drupal_alter('taxonomy_menu_link', $menu_link, $term, $menu_name);
  $mlid = menu_link_save($menu_link);

  // Let other modules perform actions after the menu item has been saved.
  foreach (module_implements('taxonomy_menu_save') as $module) {
    $function = $module . '_taxonomy_menu_save';
    $function($term, $menu_link, $mlid);
  }
  return $mlid;
}