menu.install 2.14 KB
Newer Older
1
2
3
4
5
6
7
<?php
// $Id$

/**
 * Implementation of hook_install().
 */
function menu_install() {
8
9
  // Create tables.
  drupal_install_schema('menu');
10

11
12
13
  $t = get_t();
  db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'navigation', $t('Navigation'), $t('The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.'));
  db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'primary-links', $t('Primary links'), $t('Primary links are often used at the theme layer to show the major sections of a site. A typical representation for primary links would be tabs along the top.'));
14
  db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'secondary-links', $t('Secondary links'), $t('Secondary links are often used for pages like legal notices, contact details, and other secondary navigation items that play a lesser role than primary links.'));
15
16
17
18
19
20
}

/**
 * Implementation of hook_uninstall().
 */
function menu_uninstall() {
21
22
  // Remove tables.
  drupal_uninstall_schema('menu');
23
24
  menu_rebuild();
}
25
26
27
28
29
30

/**
 * Implementation of hook_schema().
 */
function menu_schema() {
  $schema['menu_custom'] = array(
31
    'description' => t('Holds definitions for top-level custom menus (for example, Primary Links).'),
32
    'fields' => array(
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
      'menu_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Primary Key: Unique key for menu. This is used as a block delta so length is 32.'),
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Menu title; displayed at top of block.'),
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => t('Menu description.'),
      ),
52
53
54
55
56
57
58
    ),
    'primary key' => array('menu_name'),
  );

  return $schema;
}