You are here

admin_menu.install in Administration menu 8.3

Install, update, and uninstall functions for the admin menu module.

File

admin_menu.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the admin menu module.
 */

/**
 * Implements hook_install().
 */
function admin_menu_install() {

  // Increase the module weight, so admin_menu catches any alterations made by
  // other modules in hook_menu_alter().
  module_set_weight('admin_menu', 100);
}

/**
 * Implements hook_uninstall().
 */
function admin_menu_uninstall() {
  $state = \Drupal::state();

  // Delete variables.
  $state
    ->delete('admin_menu_components');
  $state
    ->delete('admin_menu_margin_top');
  $state
    ->delete('admin_menu_position_fixed');
  $state
    ->delete('admin_menu_tweak_modules');
  $state
    ->delete('admin_menu_tweak_tabs');
  $state
    ->delete('admin_menu_show_all');
  $state
    ->delete('admin_menu_display');
  $state
    ->delete('admin_menu_cache_server');
  $state
    ->delete('admin_menu_cache_client');

  // Unused variables still should be deleted.
  $state
    ->delete('admin_menu_devel_modules');
  $state
    ->delete('admin_menu_devel_modules_enabled');
  $state
    ->delete('admin_menu_devel_modules_skip');
}

/**
 * Add {cache_admin_menu} table.
 */
function admin_menu_update_7300() {
  if (!db_table_exists('cache_admin_menu')) {
    $schema = drupal_get_schema_unprocessed('system', 'cache');
    db_create_table('cache_admin_menu', $schema);
  }
}

/**
 * Remove local tasks from {menu_links} table.
 */
function admin_menu_update_7303() {
  $connection = Database::getConnection();
  $connection
    ->delete('menu_router')
    ->condition('path', 'admin/%', 'LIKE')
    ->condition('type', MENU_IS_LOCAL_TASK, '&')
    ->execute();
}

Functions

Namesort descending Description
admin_menu_install Implements hook_install().
admin_menu_uninstall Implements hook_uninstall().
admin_menu_update_7300 Add {cache_admin_menu} table.
admin_menu_update_7303 Remove local tasks from {menu_links} table.