simplemenu.admin.inc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * Settings of the simplemenu.
  6. */
  7. /**
  8. * SimpleMenu settings page.
  9. */
  10. function simplemenu_admin_settings() {
  11. // menu selection
  12. $form['default_menu'] = array(
  13. '#type' => 'fieldset',
  14. '#title' => t('Menu settings'),
  15. '#collapsible' => TRUE,
  16. '#collapsed' => FALSE,
  17. );
  18. if (module_exists('menu')) {
  19. $form['default_menu']['simplemenu_menu'] = array(
  20. '#type' => 'select',
  21. '#title' => t('Menu'),
  22. '#options' => menu_parent_options(menu_get_menus(), array( 'mlid' => 0 )), // return complete tree;
  23. '#default_value' => variable_get('simplemenu_menu', 'navigation:0'),
  24. '#description' => t('Select the menu to display.'),
  25. );
  26. }
  27. if (module_exists('devel')) {
  28. $form['default_menu']['simplemenu_devel'] = array(
  29. '#type' => 'checkbox',
  30. '#title' => t('Add devel module links'),
  31. '#default_value' => variable_get('simplemenu_devel', 0),
  32. '#description' => t('Add devel module links for those users that can access the devel module.'),
  33. );
  34. }
  35. $form['default_menu']['simplemenu_theme'] = array(
  36. '#type' => 'select',
  37. '#title' => t('Theme'),
  38. '#options' => array(
  39. 'original' => t('original'),
  40. 'blackblue' => t('black & blue'),
  41. 'custom' => t('custom'),
  42. ),
  43. '#default_value' => variable_get('simplemenu_theme', 'original'),
  44. '#description' => t('Select which theme to use. If you specify custom, you need to define CSS in your theme.'),
  45. );
  46. // advanced options
  47. $form['advanced'] = array(
  48. '#type' => 'fieldset',
  49. '#title' => t('Advanced settings'),
  50. '#collapsible' => TRUE,
  51. '#collapsed' => TRUE,
  52. );
  53. $form['advanced']['simplemenu_uid1'] = array(
  54. '#type' => 'checkbox',
  55. '#title' => t('Show to User ID 1'),
  56. '#description' => t('Check this option to enable simplemenu for user 1 (superuser/administration). This is useful if you want to use a different menu (such as admin_menu) for the superuser/admin and simplemenu for others.'),
  57. '#default_value' => variable_get('simplemenu_uid1', 1),
  58. );
  59. $form['advanced']['simplemenu_element'] = array(
  60. '#type' => 'textfield',
  61. '#title' => t('CSS selector to attach menu to'),
  62. '#default_value' => variable_get('simplemenu_element', 'body'),
  63. '#description' => t('A valid CSS selector to attach the menu to. <em>Example: body, #primary, div.my-class</em>'),
  64. '#required' => TRUE,
  65. );
  66. $form['advanced']['simplemenu_element_method'] = array(
  67. '#type' => 'radios',
  68. '#title' => t('Attach method'),
  69. '#options' => array(
  70. 'prepend' => t('Prepend'),
  71. 'append' => t('Append'),
  72. ),
  73. '#default_value' => variable_get('simplemenu_element_method', 'prepend'),
  74. '#description' => t('Choose how the menu should be attached to the above selector.'),
  75. '#required' => TRUE,
  76. );
  77. // when someone has many themes, this list grows big!
  78. $themes = list_themes();
  79. $use_list = count($themes) > 15;
  80. $form['advanced']['simplemenu_exclusions'] = array(
  81. '#type' => $use_list ? 'select' : 'checkboxes',
  82. '#title' => t('Theme exclusions'),
  83. '#options' => drupal_map_assoc(array_keys($themes)),
  84. '#multiple' => $use_list,
  85. '#default_value' => variable_get('simplemenu_exclusions', array()),
  86. '#description' => t('Select which themes to <strong>not</strong> display the menu. Use this when you have a theme that displays its own admin navigation.'),
  87. );
  88. $form['advanced']['simplemenu_hide_delay'] = array(
  89. '#type' => 'textfield',
  90. '#title' => t('Hide delay'),
  91. '#size' => 4,
  92. '#default_value' => variable_get('simplemenu_hide_delay', 800),
  93. '#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
  94. );
  95. $form['advanced']['simplemenu_effect'] = array(
  96. '#type' => 'radios',
  97. '#title' => t('Show effect'),
  98. '#options' => array(
  99. 'opacity' => t('Fade'),
  100. 'height' => t('Slide'),
  101. 'none' => t('None')
  102. ),
  103. '#default_value' => variable_get('simplemenu_effect', 'opacity'),
  104. '#description' => t('The effect used when displaying a menu.'),
  105. );
  106. $form['advanced']['simplemenu_effect_speed'] = array(
  107. '#type' => 'radios',
  108. '#title' => t('Show speed'),
  109. '#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')),
  110. '#default_value' => variable_get('simplemenu_effect_speed', 'fast'),
  111. '#description' => t('The speed of the effect, not used when "none" is set to show effect.'),
  112. );
  113. $form['advanced']['simplemenu_detect_popop'] = array(
  114. '#type' => 'checkbox',
  115. '#title' => t('Detect pop-up windows'),
  116. '#default_value' => variable_get('simplemenu_detect_popop', 1),
  117. '#description' => t("Choose whether SimpleMenu should attempt to detect if it is inside of a pop-up window. If enabled, SimpleMenu will not display if it is inside of a pop-up window."),
  118. );
  119. $form['advanced']['simplemenu_visibility_operator'] = array(
  120. '#type' => 'radios',
  121. '#title' => t('Show block on specific pages'),
  122. '#default_value' => variable_get('simplemenu_visibility_operator', 0),
  123. '#options' => array(
  124. 0 => t('Show on every page except the listed pages.'),
  125. 1 => t('Show on only the listed pages.'),
  126. ),
  127. );
  128. $form['advanced']['simplemenu_visibility_pages'] = array(
  129. '#type' => 'textarea',
  130. '#title' => t('Pages'),
  131. '#default_value' => variable_get('simplemenu_visibility_pages', ''),
  132. '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.",
  133. array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
  134. '#wysiwyg' => FALSE,
  135. );
  136. return system_settings_form($form);
  137. }