You are here

auto_menutitle.install in Auto Menu Title 7

Same filename and directory in other branches
  1. 8 auto_menutitle.install
  2. 6.2 auto_menutitle.install

Install, update and uninstall functions for the auto_menutitle module.

File

auto_menutitle.install
View source
<?php

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

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

  // Set this module's weight to one higher than that of the menu module
  $weight = db_query('SELECT weight FROM {system} WHERE type = :type AND name = :name', array(
    ':type' => 'module',
    ':name' => 'menu',
  ))
    ->fetchField();
  $weight += 1;
  db_update('system')
    ->fields(array(
    'weight' => $weight,
  ))
    ->condition('type', 'module')
    ->condition('name', 'auto_menutitle')
    ->execute();
}

/**
 * Implements hook_uninstall().
 */
function auto_menutitle_uninstall() {

  // Delete variables
  $node_types = array_keys(node_type_get_types());
  foreach ($node_types as $node_type) {
    variable_del('auto_menutitle_' . $node_type);
  }
}

Functions