menu.variable.inc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. return $variables;
  29. }
  30. /**
  31. * Implements hook_variable_group_info().
  32. */
  33. function menu_variable_group_info() {
  34. $groups['menu_settings'] = array(
  35. 'title' => t('Menu settings'),
  36. 'access' => 'administer menu',
  37. 'path' => 'admin/structure/menu/settings',
  38. );
  39. return $groups;
  40. }
  41. /**
  42. * Implements hook_variable_type_info()
  43. */
  44. function menu_variable_type_info() {
  45. $type['menu'] = array(
  46. 'title' => t('Menu'),
  47. 'type' => 'select',
  48. 'options callback' => 'menu_variable_menu_list',
  49. );
  50. return $type;
  51. }
  52. /**
  53. * Menu option list
  54. */
  55. function menu_variable_menu_list($variable, $options) {
  56. return menu_get_menus();
  57. }