Skip to content
muchomenu.install 4.33 KiB
Newer Older
Noah Lively's avatar
Noah Lively committed
<?php

/**
 * @file
 *
 * Install file for the muchomenu module
 */

/**
 * Implements hook_schema().
 */
function muchomenu_schema() {
  $schema['muchomenu_menus'] = array(
      'description' => 'Stores the enabled state and other attributes of mucho menus.',
      'fields' => array(
          'id' => array(
              'type' => 'serial',
              'not null' => TRUE,
              'unsigned' => TRUE,
              'description' => 'Numeric menu ID',
          ),
          'title' => array(
              'type' => 'varchar',
              'not null' => TRUE,
              'default' => '',
              'length' => 255
          ),
          'description' => array(
              'type' => 'text',
              'not null' => FALSE,
          ),
          'enabled' => array(
              'description' => 'Enabled state of a mucho menu: 1 = enabled, 0 = disabled',
              'type' => 'int',
              'unsigned' => FALSE,
              'size' => 'tiny',
              'default' => '0',
          ),
          'orientation' => array(
              'description' => 'Orientation of the entire menu (horizontal or vertical)',
              'type' => 'varchar',
              'length' => '12',
              'not null' => TRUE,
              'default' => 'horizontal',
          ),
          'animation_effect' => array(
              'description' => 'Animation effect to use when showing or hiding the menu',
              'type' => 'varchar',
              'length' => '80',
              'not null' => TRUE,
              'default' => '',
          ),
          'animation_speed' => array(
              'description' => 'Animation speed',
              'type' => 'varchar',
              'length' => '10',
              'not null' => TRUE,
              'default' => '',
          ),
      ),
      'primary key' => array('id'),
  );

  $schema['muchomenu_items'] = array(
      'fields' => array(
          'id' => array(
              'type' => 'serial',
              'not null' => TRUE,
              'unsigned' => TRUE,
              'description' => 'Menu item ID',
          ),
          'menu_id' => array(
              'type' => 'int',
              'not null' => TRUE,
              'default' => 0,
              'unsigned' => TRUE,
              'description' => 'Foreign key pointing to the muchomenu_menus table',
          ),
          'path' => array(
              'type' => 'varchar',
              'not null' => TRUE,
              'default' => '',
              'length' => 255,
              'description' => 'Menu item path',
          ),
          'panel_name' => array(
              'type' => 'varchar',
              'not null' => TRUE,
              'default' => '',
              'length' => 255,
          ),
          'title' => array(
              'type' => 'varchar',
              'not null' => TRUE,
              'default' => '',
              'length' => 255,
          ),
          'alt' => array(
              'type' => 'varchar',
              'not null' => TRUE,
              'default' => '',
              'length' => 255,
          ),
          'weight' => array(
              'type' => 'int',
              'not null' => TRUE,
              'default' => 0,
              'size' => 'tiny',
          ),
          'enabled' => array(
              'type' => 'int',
              'not null' => TRUE,
              'default' => 1,
              'size' => 'tiny',
          ),
          'description' => array(
              'type' => 'text',
              'not null' => FALSE,
          ),
          'target' => array(
              'type' => 'int',
              'not null' => TRUE,
              'default' => 0,
              'size' => 'tiny',
          ),
          'disable_click' => array(
              'type' => 'int',
              'not null' => TRUE,
              'default' => 1,
              'size' => 'tiny',
          )
      ),
      'primary key' => array('id'),
  );

  return $schema;
}

/**
 * Implements hook_install().
 */
function muchomenu_install() {
  // Create muchomenu tables.
  // TODO The drupal_(un)install_schema functions are called automatically in D7.
  // drupal_install_schema('muchomenu')
}

/**
 * Implements hook_uninstall().
 */
function muchomenu_uninstall() {
  // Delete muchomenu tables.
  // TODO The drupal_(un)install_schema functions are called automatically in D7.
  // drupal_uninstall_schema('muchomenu')
}