You are here

function taxonomy_menu_menu_links_update in Taxonomy menu 8

Same name and namespace in other branches
  1. 7.2 taxonomy_menu.module \taxonomy_menu_menu_links_update()

Updates menu links associated to a vocabulary.

Parameters

$vid: The ID of the vocabulary.

1 call to taxonomy_menu_menu_links_update()
taxonomy_menu_vocab_submit in ./taxonomy_menu.admin.inc
Form submission handler for taxonomy_form_vocabulary().

File

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

Code

function taxonomy_menu_menu_links_update($vid) {

  // Get a list of all the existing taxonomy terms for that vocabulary and
  // process them using the bacth API.
  $menu_name = taxonomy_menu_variable_get('vocab_menu', $vid, FALSE);
  $tm_menu_links = _taxonomy_menu_get_menu_items($vid);
  $term_ids = array_values($tm_menu_links);
  $terms = entity_load_multiple('taxonomy_term', $term_ids);
  _taxonomy_menu_save_menu_links_batch($terms, $menu_name);
  menu_cache_clear_all($menu_name);
  drupal_set_message(t('The Taxonomy menu has been updated.'), 'status');
}