menu.install

  1. 7.x drupal-7.x/modules/menu/menu.install
  2. 6.x drupal-6.x/modules/menu/menu.install

File

drupal-6.x/modules/menu/menu.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function menu_install() {
  6. // Create tables.
  7. drupal_install_schema('menu');
  8. $t = get_t();
  9. 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.'));
  10. 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.'));
  11. 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'));
  12. }
  13. /**
  14. * Implementation of hook_uninstall().
  15. */
  16. function menu_uninstall() {
  17. // Remove tables.
  18. drupal_uninstall_schema('menu');
  19. menu_rebuild();
  20. }
  21. /**
  22. * Implementation of hook_schema().
  23. */
  24. function menu_schema() {
  25. $schema['menu_custom'] = array(
  26. 'description' => 'Holds definitions for top-level custom menus (for example, Primary Links).',
  27. 'fields' => array(
  28. 'menu_name' => array(
  29. 'type' => 'varchar',
  30. 'length' => 32,
  31. 'not null' => TRUE,
  32. 'default' => '',
  33. 'description' => 'Primary Key: Unique key for menu. This is used as a block delta so length is 32.',
  34. ),
  35. 'title' => array(
  36. 'type' => 'varchar',
  37. 'length' => 255,
  38. 'not null' => TRUE,
  39. 'default' => '',
  40. 'description' => 'Menu title; displayed at top of block.',
  41. ),
  42. 'description' => array(
  43. 'type' => 'text',
  44. 'not null' => FALSE,
  45. 'description' => 'Menu description.',
  46. ),
  47. ),
  48. 'primary key' => array('menu_name'),
  49. );
  50. return $schema;
  51. }