You are here

megamenu.install in Megamenu 7

Same filename and directory in other branches
  1. 6.2 megamenu.install
  2. 6 megamenu.install

Installation related functions.

File

megamenu.install
View source
<?php

/**
 * @file
 * Installation related functions.
 */

/**
 * Implements hook_uninstall().
 */
function megamenu_uninstall() {
  variable_del('megamenu_menu_timeout');
  variable_del('megamenu_menu_sizewait');
  variable_del('megamenu_menu_hoverwait');
}

/**
 * Implements hook_schema().
 */
function megamenu_schema() {
  $schema['megamenu'] = array(
    'description' => 'Stores the enabled state and other attributes of mega menus.',
    'fields' => array(
      'menu_name' => array(
        'description' => 'The name of a Drupal menu and corresponding mega menu',
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => '',
      ),
      'enabled' => array(
        'description' => 'Enabled state of a mega menu: 1 = enabled, 0 = dissabled',
        'type' => 'int',
        'unsigned' => FALSE,
        'size' => 'tiny',
        'default' => 0,
      ),
      'skin' => array(
        'description' => 'Name of skin (CSS class)',
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => 'friendly',
      ),
      'menu_orientation' => array(
        'description' => 'Orientation of the entire menu (horizontal or vertical)',
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => 'horizontal',
      ),
      'slot_orientation' => array(
        'description' => 'Orientation CSS class to apply to slots (stacking or columnar)',
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => 'columnar',
      ),
      'slot_attributes' => array(
        'description' => 'Custom CSS classes to apply to slots',
        'type' => 'text',
        'size' => 'small',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'menu_name',
    ),
  );
  return $schema;
}

/**
 * Alter the schema to correct the default storage of the enabled state.
 */
function megamenu_update_7000() {
  $spec = array(
    'description' => t('Enabled state of a Megamenu: 1 = enabled, 0 = disabled'),
    'type' => 'int',
    'unsigned' => FALSE,
    'size' => 'tiny',
    'default' => 0,
  );
  $result = db_change_field('megamenu', 'enabled', 'enabled', $spec);
  return $result;
}

Functions

Namesort descending Description
megamenu_schema Implements hook_schema().
megamenu_uninstall Implements hook_uninstall().
megamenu_update_7000 Alter the schema to correct the default storage of the enabled state.