adminimal_menu_settings.inc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @file
  4. * Menu builder functions for Administration menu.
  5. */
  6. /**
  7. * Create the settings page form.
  8. */
  9. function adminimal_admin_menu_settings($form, &$form_state) {
  10. // Create the shortcut category.
  11. $form['shortcuts'] = array(
  12. '#type' => 'fieldset',
  13. '#title' => t('Shortcuts options'),
  14. );
  15. // Create the select list.
  16. $form['shortcuts']['adminimal_admin_menu_render'] = array(
  17. '#type' => 'select',
  18. '#title' => t('Rendering method'),
  19. '#default_value' => variable_get('adminimal_admin_menu_render', 'collapsed'),
  20. '#options' => array(
  21. 'hidden' => t('Hidden'),
  22. 'inline' => t('Inline'),
  23. 'collapsed' => t('Collapsed'),
  24. 'newline' => t('Newline'),
  25. 'dropdown' => t('Dropdown'),
  26. 'exclusive' => t('Exclusive'),
  27. ),
  28. '#description' => t('Select how the shortcuts will be rendered. There are currently 6 options: <ol> <li>Hidden -> The shortcuts will not be rendered inside the admin menu</li> <li>Inline -> The shortcuts will be rendered on the same line with the root menu links</li> <li>Collapsed -> The sorctus links will be collapsed like a normal menu. <strong>(Default option)</strong></li> <li>Newline -> The shortcuts will be rendered on a new line. Below the root menu links.</li> <li>Dropdown -> The shortcuts will be rendered inside a dropdown using the select html tag.</li> <li>Exclusive -> Only the shortcuts will be rendered, and the normal menu will be hidden.</li></ol>'),
  29. '#required' => TRUE,
  30. );
  31. // Create the submit button.
  32. $form['submit'] = array(
  33. '#type' => 'submit',
  34. '#value' => t('Save configuration'),
  35. );
  36. return $form;
  37. }
  38. /**
  39. * Submit handler for views_sexy_throbber_settings().
  40. */
  41. function adminimal_admin_menu_settings_submit($form, &$form_state) {
  42. // Exclude unnecessary elements.
  43. form_state_values_clean($form_state);
  44. foreach ($form_state['values'] as $key => $value) {
  45. if (is_array($value) && isset($form_state['values']['array_filter'])) {
  46. $value = array_keys(array_filter($value));
  47. }
  48. variable_set($key, $value);
  49. }
  50. // Clear the admin menu cache.
  51. admin_menu_flush_caches();
  52. // Display a message to the user.
  53. drupal_set_message(t('The configuration options have been saved.'));
  54. }