You are here

function og_menu_uninstall in Organic Groups Menu (OG Menu) 7.3

Same name and namespace in other branches
  1. 6.2 og_menu.install \og_menu_uninstall()
  2. 6 og_menu.install \og_menu_uninstall()
  3. 7.2 og_menu.install \og_menu_uninstall()

Implements hook_uninstall().

File

./og_menu.install, line 63
Install, update and uninstall functions for the og_menu module.

Code

function og_menu_uninstall() {

  // List custom vars.
  $vars = array(
    'og_menu_assignment',
    'og_menu_block_links',
    'og_menu_max_menus_per_group',
    'og_menu_show_blocks',
    'og_menu_show_homebox',
    'og_menu_show_menuposition',
    'og_menu_show_nodetype',
    'og_menu_context_limit',
    'og_menu_hide_create_option',
    'og_menu_create_by_default',
    'og_menu_hide_help',
  );

  // List all og_menu related node type settings vars.
  $node_types = node_type_get_types();
  foreach ($node_types as $type) {
    $vars[] = 'og_menu_enable_' . $type->type;
  }

  // Finally, delete all the vars we listed.
  foreach ($vars as $var) {
    variable_del($var);
  }

  // Delete custom menus.
  $result = db_select('og_menu', 'm')
    ->fields('m', array(
    'menu_name',
  ))
    ->execute();
  while ($record = $result
    ->fetchAssoc()) {
    if ($menu = menu_load($record['menu_name'])) {
      menu_delete($menu);
    }
  }
}