simplemenu.admin.inc 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. // standard settings
  47. $form['settings'] = array(
  48. '#type' => 'fieldset',
  49. '#title' => t('Simplemenu settings'),
  50. '#collapsible' => TRUE,
  51. '#collapsed' => TRUE,
  52. );
  53. $form['settings']['simplemenu_hide_delay'] = array(
  54. '#type' => 'textfield',
  55. '#title' => t('Hide delay'),
  56. '#size' => 4,
  57. '#default_value' => variable_get('simplemenu_hide_delay', 800),
  58. '#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
  59. );
  60. $form['settings']['simplemenu_scroll_effect'] = array(
  61. '#type' => 'radios',
  62. '#title' => t('Scroll effect'),
  63. '#options' => array(
  64. 'scroll' => t('Scroll with the page'),
  65. 'fixed' => t('Fixed'),
  66. ),
  67. '#default_value' => variable_get('simplemenu_scroll_effect', 'scroll'),
  68. '#description' => t('Whether the menu scrolls with the page or stays at the top or bottom (this should only be used when the menu is attached to the &lt;body&gt; tag.)'),
  69. );
  70. $form['settings']['simplemenu_effect'] = array(
  71. '#type' => 'radios',
  72. '#title' => t('Show effect'),
  73. '#options' => array(
  74. 'opacity' => t('Fade'),
  75. 'height' => t('Slide'),
  76. 'none' => t('None')
  77. ),
  78. '#default_value' => variable_get('simplemenu_effect', 'opacity'),
  79. '#description' => t('The effect used when displaying a menu.'),
  80. );
  81. $form['settings']['simplemenu_effect_speed'] = array(
  82. '#type' => 'radios',
  83. '#title' => t('Show speed'),
  84. '#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')),
  85. '#default_value' => variable_get('simplemenu_effect_speed', 'fast'),
  86. '#description' => t('The speed of the effect, not used when "none" is set to show effect.'),
  87. );
  88. // advanced options
  89. $form['advanced'] = array(
  90. '#type' => 'fieldset',
  91. '#title' => t('Advanced settings'),
  92. '#collapsible' => TRUE,
  93. '#collapsed' => TRUE,
  94. );
  95. $form['advanced']['simplemenu_uid1'] = array(
  96. '#type' => 'checkbox',
  97. '#title' => t('Show to User ID 1'),
  98. '#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.'),
  99. '#default_value' => variable_get('simplemenu_uid1', 1),
  100. );
  101. $form['advanced']['simplemenu_element'] = array(
  102. '#type' => 'textfield',
  103. '#title' => t('CSS selector to attach menu to'),
  104. '#default_value' => variable_get('simplemenu_element', 'body'),
  105. '#description' => t('A valid CSS selector to attach the menu to. <em>Example: body, #primary, div.my-class</em>'),
  106. '#required' => TRUE,
  107. );
  108. $form['advanced']['simplemenu_element_method'] = array(
  109. '#type' => 'radios',
  110. '#title' => t('Attach method'),
  111. '#options' => array(
  112. 'prepend' => t('Prepend'),
  113. 'append' => t('Append'),
  114. ),
  115. '#default_value' => variable_get('simplemenu_element_method', 'prepend'),
  116. '#description' => t('Choose how the menu should be attached to the above selector.'),
  117. '#required' => TRUE,
  118. );
  119. // when someone has many themes, this list grows big!
  120. $themes = list_themes();
  121. $use_list = count($themes) > 15;
  122. $form['advanced']['simplemenu_exclusions'] = array(
  123. '#type' => $use_list ? 'select' : 'checkboxes',
  124. '#title' => t('Theme exclusions'),
  125. '#options' => drupal_map_assoc(array_keys($themes)),
  126. '#multiple' => $use_list,
  127. '#default_value' => variable_get('simplemenu_exclusions', array()),
  128. '#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.'),
  129. );
  130. $form['advanced']['simplemenu_detect_popop'] = array(
  131. '#type' => 'checkbox',
  132. '#title' => t('Detect pop-up windows'),
  133. '#default_value' => variable_get('simplemenu_detect_popop', 1),
  134. '#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."),
  135. );
  136. $form['advanced']['simplemenu_visibility_operator'] = array(
  137. '#type' => 'radios',
  138. '#title' => t('Show block on specific pages'),
  139. '#default_value' => variable_get('simplemenu_visibility_operator', 0),
  140. '#options' => array(
  141. 0 => t('Show on every page except the listed pages.'),
  142. 1 => t('Show on only the listed pages.'),
  143. ),
  144. );
  145. $form['advanced']['simplemenu_visibility_pages'] = array(
  146. '#type' => 'textarea',
  147. '#title' => t('Pages'),
  148. '#default_value' => variable_get('simplemenu_visibility_pages', ''),
  149. '#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.",
  150. array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
  151. '#wysiwyg' => FALSE,
  152. );
  153. return system_settings_form($form);
  154. }