menu.variable.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @file
  4. * Variable API module. Definition for Drupal core variables
  5. */
  6. /**
  7. * Implements hook_variable_info().
  8. */
  9. function menu_variable_info($options) {
  10. $variables['menu_main_links_source'] = array(
  11. 'type' => 'select',
  12. 'title' => t('Source for the Main links'),
  13. 'options' => 'menu',
  14. 'default' => 'main-menu',
  15. 'element' => array('#empty_option' => t('No Main links')),
  16. 'description' => t('Select what should be displayed as the Main links (typically at the top of the page).', array(), $options),
  17. 'group' => 'menu_settings'
  18. );
  19. $variables['menu_secondary_links_source'] = array(
  20. 'type' => 'select',
  21. 'title' => t('Source for the Secondary links'),
  22. 'options' => 'menu',
  23. 'default' => 'user-menu',
  24. 'element' => array('#empty_option' => t('No Secondary links')),
  25. 'description' => t('Select the source for the Secondary links.', array() , $options),
  26. 'group' => 'menu_settings'
  27. );
  28. $variables['menu_parent_[node_type]'] = array(
  29. 'type' => 'multiple',
  30. 'title' => t('Menu parent'),
  31. 'repeat' => array(
  32. 'type' => 'select',
  33. 'options' => 'menu',
  34. ),
  35. 'group' => 'menu_settings',
  36. 'description' => t('Select the menu parent', array(), $options),
  37. );
  38. $variables['menu_options_[node_type]'] = array(
  39. 'type' => 'multiple',
  40. 'title' => t('Menu options'),
  41. 'repeat' => array(
  42. 'type' => 'options',
  43. 'options' => 'menu',
  44. ),
  45. 'description' => t('Select the available menus',array() , $options),
  46. 'group' => 'menu_settings',
  47. );
  48. return $variables;
  49. }
  50. /**
  51. * Implements hook_variable_group_info().
  52. */
  53. function menu_variable_group_info() {
  54. $groups['menu_settings'] = array(
  55. 'title' => t('Menu settings'),
  56. 'access' => 'administer menu',
  57. 'path' => 'admin/structure/menu/settings',
  58. );
  59. return $groups;
  60. }
  61. /**
  62. * Implements hook_variable_type_info()
  63. */
  64. function menu_variable_type_info() {
  65. $type['menu'] = array(
  66. 'title' => t('Menu'),
  67. 'type' => 'select',
  68. 'options callback' => 'menu_variable_menu_list',
  69. );
  70. return $type;
  71. }
  72. /**
  73. * Menu option list
  74. */
  75. function menu_variable_menu_list($variable, $options) {
  76. return menu_get_menus();
  77. }