| 1 |
<?php
|
| 2 |
// $Id: menu.install,v 1.22 2009/10/13 18:36:25 dries Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install, update and uninstall functions for the menu module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implement hook_schema().
|
| 11 |
*/
|
| 12 |
function menu_schema() {
|
| 13 |
$schema['menu_custom'] = array(
|
| 14 |
'description' => 'Holds definitions for top-level custom menus (for example, Main menu).',
|
| 15 |
'fields' => array(
|
| 16 |
'menu_name' => array(
|
| 17 |
'type' => 'varchar',
|
| 18 |
'length' => 32,
|
| 19 |
'not null' => TRUE,
|
| 20 |
'default' => '',
|
| 21 |
'description' => 'Primary Key: Unique key for menu. This is used as a block delta so length is 32.',
|
| 22 |
),
|
| 23 |
'title' => array(
|
| 24 |
'type' => 'varchar',
|
| 25 |
'length' => 255,
|
| 26 |
'not null' => TRUE,
|
| 27 |
'default' => '',
|
| 28 |
'description' => 'Menu title; displayed at top of block.',
|
| 29 |
'translatable' => TRUE,
|
| 30 |
),
|
| 31 |
'description' => array(
|
| 32 |
'type' => 'text',
|
| 33 |
'not null' => FALSE,
|
| 34 |
'description' => 'Menu description.',
|
| 35 |
'translatable' => TRUE,
|
| 36 |
),
|
| 37 |
),
|
| 38 |
'primary key' => array('menu_name'),
|
| 39 |
);
|
| 40 |
|
| 41 |
return $schema;
|
| 42 |
}
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Implement hook_install().
|
| 46 |
*/
|
| 47 |
function menu_install() {
|
| 48 |
$system_menus = menu_list_system_menus();
|
| 49 |
$t = get_t();
|
| 50 |
$descriptions = array(
|
| 51 |
'navigation' => $t('The <em>Navigation</em> menu contains links such as Recent posts (if the Tracker module is enabled). Non-administrative links are added to this menu by default by modules.'),
|
| 52 |
'user-menu' => $t("The <em>User menu</em> contains links related to the user's account, as well as the 'Log out' link."),
|
| 53 |
'management' => $t('The <em>Management</em> menu contains links for content creation, structure, user management, and similar site activities.'),
|
| 54 |
'main-menu' => $t('The <em>Main menu</em> is the default source for the Main links which are often used by themes to show the major sections of a site.'),
|
| 55 |
'secondary-menu' => $t('The <em>Secondary menu</em> is the default source for the Secondary links which are often used for legal notices, contact details, and other navigation items that play a lesser role than the Main links.'),
|
| 56 |
);
|
| 57 |
foreach ($system_menus as $menu_name => $title) {
|
| 58 |
$menu = array(
|
| 59 |
'menu_name' => $menu_name,
|
| 60 |
'title' => $t($title),
|
| 61 |
'description' => $descriptions[$menu_name],
|
| 62 |
);
|
| 63 |
menu_save($menu);
|
| 64 |
}
|
| 65 |
}
|
| 66 |
|
| 67 |
/**
|
| 68 |
* Implement hook_uninstall().
|
| 69 |
*/
|
| 70 |
function menu_uninstall() {
|
| 71 |
menu_rebuild();
|
| 72 |
}
|
| 73 |
|