You are here

function taxonomy_menu_menu_links_delete in Taxonomy menu 7.2

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

Deletes all the menu links associated to a vocabulary.

Parameters

$vid: The vocabulary ID from which to delete the menu items.

3 calls to taxonomy_menu_menu_links_delete()
taxonomy_menu_rebuild in ./taxonomy_menu.module
Rebuilds all the menu items.
taxonomy_menu_taxonomy_vocabulary_delete in ./taxonomy_menu.module
Implements hook_taxonomy_vocabulary_delete().
taxonomy_menu_vocab_submit in ./taxonomy_menu.admin.inc
Form submission handler for taxonomy_form_vocabulary().

File

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

Code

function taxonomy_menu_menu_links_delete($vid) {

  // Get a list of all the taxonomy terms for this vocabulary and delete them.
  // Deleting means that the menu links are deleted and their respective
  // associations in {taxonomy_menu} table as well.
  $menu_items = _taxonomy_menu_get_menu_items($vid);
  $mlids = array_keys($menu_items);
  foreach ($mlids as $mlid) {
    menu_link_delete($mlid);
  }
  _taxonomy_menu_delete_all($vid);

  // Remove orphaned links.
  $menu_items = _taxonomy_menu_get_orphaned_menu_items($vid);
  if (!empty($menu_items)) {
    $mlids = array_values($menu_items);
    foreach ($mlids as $mlid) {
      menu_link_delete($mlid);
    }
  }
  drupal_set_message(t('The Taxonomy menu has been removed.'), 'status');
}