2007-04-06 05:29:22 +00:00
<?php
// $Id$
2009-05-13 19:42:18 +00:00
/**
* @file
* Install, update and uninstall functions for the menu module.
*/
2007-04-06 05:29:22 +00:00
/**
2009-05-27 18:34:03 +00:00
* Implement hook_install().
2007-04-06 05:29:22 +00:00
*/
function menu_install() {
2007-05-25 12:46:46 +00:00
// Create tables.
drupal_install_schema('menu');
2009-03-20 19:18:11 +00:00
$system_menus = menu_list_system_menus();
$descriptions = array(
'navigation' => '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.',
2009-03-25 13:55:22 +00:00
'user-menu' => "The <em>User menu</em> contains links related to the user's account, as well as the 'Log out' link.",
2009-07-20 18:51:36 +00:00
'management' => 'The <em>Management</em> menu contains links for content creation, structure, user management, and similar site activities.',
2009-03-20 19:18:11 +00:00
'main-menu' => '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.',
'secondary-menu' => '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.',
);
2008-01-30 20:27:28 +00:00
$t = get_t();
2009-03-20 19:18:11 +00:00
$query = db_insert('menu_custom')->fields(array('menu_name', 'title', 'description'));
foreach ($system_menus as $menu_name => $title) {
$query->values(array('menu_name' => $menu_name, 'title' => $t($title), 'description' => $t($descriptions[$menu_name])))->execute();
}
2007-04-06 05:29:22 +00:00
}
/**
2009-05-27 18:34:03 +00:00
* Implement hook_uninstall().
2007-04-06 05:29:22 +00:00
*/
function menu_uninstall() {
2007-05-25 12:46:46 +00:00
// Remove tables.
drupal_uninstall_schema('menu');
2007-04-06 05:29:22 +00:00
menu_rebuild();
}
2007-10-05 14:43:26 +00:00
/**
2009-05-27 18:34:03 +00:00
* Implement hook_schema().
2007-10-05 14:43:26 +00:00
*/
function menu_schema() {
$schema['menu_custom'] = array(
2008-11-15 13:01:11 +00:00
'description' => 'Holds definitions for top-level custom menus (for example, Main menu).',
2007-10-05 14:43:26 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'menu_name' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
2008-11-15 13:01:11 +00:00
'description' => 'Primary Key: Unique key for menu. This is used as a block delta so length is 32.',
2007-10-10 11:39:35 +00:00
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
2008-11-15 13:01:11 +00:00
'description' => 'Menu title; displayed at top of block.',
2007-10-10 11:39:35 +00:00
),
'description' => array(
'type' => 'text',
'not null' => FALSE,
2008-11-15 13:01:11 +00:00
'description' => 'Menu description.',
2007-10-10 11:39:35 +00:00
),
2007-10-05 14:43:26 +00:00
),
'primary key' => array('menu_name'),
);
return $schema;
}