2007-04-06 05:29:22 +00:00
<?php
2009-05-13 19:42:18 +00:00
/**
* @file
* Install, update and uninstall functions for the menu module.
*/
2007-10-05 14:43:26 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements 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.',
2009-10-16 19:06:25 +00:00
'translatable' => TRUE,
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.',
2009-10-16 19:06:25 +00:00
'translatable' => TRUE,
2007-10-10 11:39:35 +00:00
),
2007-10-05 14:43:26 +00:00
),
'primary key' => array('menu_name'),
);
return $schema;
}
2009-10-13 18:36:25 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_install().
2009-10-13 18:36:25 +00:00
*/
function menu_install() {
$system_menus = menu_list_system_menus();
$t = get_t();
$descriptions = array(
2010-01-10 17:55:19 +00:00
'navigation' => $t('The <em>Navigation</em> menu contains links intended for site visitors. Links are added to the <em>Navigation</em> menu automatically by some modules.'),
'user-menu' => $t("The <em>User</em> menu contains links related to the user's account, as well as the 'Log out' link."),
'management' => $t('The <em>Management</em> menu contains links for administrative tasks.'),
'main-menu' => $t('The <em>Main</em> menu is used on many sites to show the major sections of the site, often in a top navigation bar.'),
2009-10-13 18:36:25 +00:00
);
foreach ($system_menus as $menu_name => $title) {
$menu = array(
'menu_name' => $menu_name,
'title' => $t($title),
'description' => $descriptions[$menu_name],
);
menu_save($menu);
}
}
/**
2009-12-04 16:49:48 +00:00
* Implements hook_uninstall().
2009-10-13 18:36:25 +00:00
*/
function menu_uninstall() {
2012-05-03 15:09:39 +00:00
menu_router_rebuild();
2009-10-13 18:36:25 +00:00
}
2012-08-03 17:09:51 +00:00
/**
* Moves menu settings from variables to config.
*
* @ingroup config_upgrade
*/
function menu_update_8000() {
update_variables_to_config('menu.settings', array(
'menu_main_links_source' => 'main_links',
'menu_secondary_links_source' => 'secondary_links',
));
}