You are here

function _taxonomy_menu_get_orphaned_menu_items in Taxonomy menu 8

Same name and namespace in other branches
  1. 7.2 taxonomy_menu.database.inc \_taxonomy_menu_get_orphaned_menu_items()

Get orphaned menu relations for a vocab.

Parameters

int $vid: The vocabulary's ID.

Return value

array An array of orphaned menu links' ID.

1 call to _taxonomy_menu_get_orphaned_menu_items()
taxonomy_menu_menu_links_delete in ./taxonomy_menu.module
Deletes all the menu links associated to a vocabulary.

File

./taxonomy_menu.database.inc, line 91
Database functions.

Code

function _taxonomy_menu_get_orphaned_menu_items($vid) {
  $vocabulary = entity_load('taxonomy_vocabulary', $vid);
  $menu_name = \Drupal::config('taxonomy_menu.settings')
    ->get('taxonomy_menu_vocab_menu_' . $vid);
  if ($menu_name) {
    $query = db_select('menu_links', 'ml')
      ->fields('ml', array(
      'mlid',
    ))
      ->condition('ml.menu_name', $menu_name)
      ->condition('ml.link_path', 'taxonomy/term/%');
    return $query
      ->execute()
      ->fetchCol();
  }
  return FALSE;
}