menu_link.install 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Menu link module.
  5. */
  6. /**
  7. * Implements hook_field_schema().
  8. */
  9. function menu_link_field_schema($field) {
  10. $menu_links = drupal_get_schema_unprocessed('system', 'menu_links');
  11. $schema = array(
  12. 'columns' => array(
  13. 'mlid' => array(
  14. 'description' => 'The {menu_links}.mlid being referenced in this field.',
  15. 'type' => 'int',
  16. 'unsigned' => TRUE,
  17. 'not null' => TRUE,
  18. 'default' => 0,
  19. ),
  20. // Columns below are being used for revision control.
  21. 'menu_name' => $menu_links['fields']['menu_name'],
  22. 'plid' => $menu_links['fields']['plid'],
  23. 'link_path' => $menu_links['fields']['link_path'],
  24. 'link_title' => $menu_links['fields']['link_title'],
  25. 'options' => $menu_links['fields']['options'],
  26. 'hidden' => $menu_links['fields']['hidden'],
  27. 'expanded' => $menu_links['fields']['expanded'],
  28. 'weight' => $menu_links['fields']['weight'],
  29. ),
  30. 'indexes' => array(
  31. 'mlid' => array('mlid'),
  32. 'menu_plid' => array('menu_name', 'plid'),
  33. ),
  34. 'foreign keys' => array(
  35. 'menu_link' => array(
  36. 'table' => 'menu_links',
  37. 'columns' => array('mlid' => 'mlid'),
  38. ),
  39. 'parent_menu_link' => array(
  40. 'table' => 'menu_links',
  41. 'columns' => array('plid' => 'mlid'),
  42. ),
  43. ),
  44. );
  45. if (module_exists('menu')) {
  46. $schema['foreign keys']['menu'] = array(
  47. 'table' => 'menu_custom',
  48. 'columns' => array('menu_name' => 'menu_name'),
  49. );
  50. }
  51. return $schema;
  52. }