Skip to content
Snippets Groups Projects
menu.install 2.32 KiB
Newer Older
/**
 * @file
 * Install, update and uninstall functions for the menu module.
 */

 */
function menu_schema() {
  $schema['menu_custom'] = array(
    'description' => 'Holds definitions for top-level custom menus (for example, Main menu).',
      'menu_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => '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' => 'Menu title; displayed at top of block.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
/**
 * Implement hook_install().
 */
function menu_install() {
  $system_menus = menu_list_system_menus();
  $t = get_t();
  $descriptions = array(
    '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.'),
    'user-menu' => $t("The <em>User menu</em> 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 content creation, structure, user management, and similar site activities.'),
    '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.'),
    '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.'),
  );
  foreach ($system_menus as $menu_name => $title) {
    $menu = array(
      'menu_name' => $menu_name,
      'title' => $t($title),
      'description' => $descriptions[$menu_name],
    );
    menu_save($menu);
  }
}

/**
 * Implement hook_uninstall().
 */
function menu_uninstall() {
  menu_rebuild();
}