adminimal_admin_menu.admin.inc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * @file
  4. * Administation settings for Adminimal Admin Menu.
  5. */
  6. /**
  7. * Settings page form.
  8. */
  9. function adminimal_admin_menu_settings($form, &$form_state) {
  10. // Create the shortcut category.
  11. $form['shortcut'] = array(
  12. '#type' => 'fieldset',
  13. '#title' => t('Shortcut options'),
  14. );
  15. if (module_exists('shortcut')) {
  16. // Create the select list.
  17. $form['shortcut']['adminimal_admin_menu_render'] = array(
  18. '#type' => 'radios',
  19. '#title' => t('Rendering method'),
  20. '#default_value' => variable_get('adminimal_admin_menu_render', 'collapsed'),
  21. '#options' => array(
  22. 'hidden' => t('Hidden'),
  23. 'inline' => t('Inline'),
  24. 'collapsed' => t('Collapsed'),
  25. 'newline' => t('Newline'),
  26. 'dropdown' => t('Dropdown'),
  27. 'exclusive' => t('Exclusive'),
  28. ),
  29. '#required' => TRUE,
  30. );
  31. $descriptions = &$form['shortcut']['adminimal_admin_menu_render'];
  32. $descriptions['hidden']['#description'] = t('Shortcuts will not be rendered inside the admin menu.');
  33. $descriptions['inline']['#description'] = t('Shortcuts will be rendered on the same line with the root menu links.');
  34. $descriptions['collapsed']['#description'] = t('Shortcuts will be collapsed like a normal menu.');
  35. $descriptions['newline']['#description'] = t('<b>(Default)</b>') . ' ' . t('Shortcuts will be rendered on a new line, below the root menu links.');
  36. $descriptions['dropdown']['#description'] = t('Shortcuts will be rendered inside a dropdown using the select html tag.');
  37. $descriptions['exclusive']['#description'] = t('Only the shortcuts will be rendered; the normal menu will be hidden.');
  38. }
  39. else {
  40. $form['shortcut']['#description'] = t('Module Shortcut is supported, but not required by Adminimal Admin Menu.');
  41. }
  42. // Create the advanced settings category.
  43. $form['advanced_settings'] = array(
  44. '#type' => 'fieldset',
  45. '#title' => t('Advanced settings'),
  46. '#description' => t('Do not change any of the advanced setting unless you know what you are doing!'),
  47. '#collapsible' => TRUE,
  48. '#collapsed' => TRUE,
  49. );
  50. $form['advanced_settings']['adminimal_admin_menu_slicknav'] = array(
  51. '#type' => 'checkbox',
  52. '#default_value' => variable_get('adminimal_admin_menu_slicknav', TRUE),
  53. '#title' => t('Enable Responsive Menu.'),
  54. '#description' => t('Enable this option if you want to have responsive menu and mobile device support. While disabling this option could save you few kilobytes (around 3KB), it will completely disable the responsive menu functionality.'),
  55. );
  56. $form['advanced_settings']['adminimal_admin_menu_jquery'] = array(
  57. '#type' => 'checkbox',
  58. '#default_value' => variable_get('adminimal_admin_menu_jquery', TRUE),
  59. '#title' => t('Load the required jQuery 1.7 library automagically.'),
  60. '#description' => t('This will load the newer jQuery version 1.7 using the no-conflict method so it won\'t interfere with any existing jQuery or other JavaScript libraries. The only reason to un-check this if you are already using a newer version of jQuery site-wide and its globally accessible by the "$" variable. Un-cheking this option could save you 33KB, but it may also break your JavaScript if not used correctly.'),
  61. '#states' => array(
  62. // Hide the settings when the cancel notify checkbox is disabled.
  63. 'visible' => array(
  64. ':input[name="adminimal_admin_menu_slicknav"]' => array('checked' => TRUE),
  65. ),
  66. ),
  67. );
  68. $form['advanced_settings']['adminimal_admin_menu_viewport'] = array(
  69. '#type' => 'checkbox',
  70. '#default_value' => variable_get('adminimal_admin_menu_viewport', TRUE),
  71. '#title' => t('Set the metatag viewport <em>\'width=device-width, initial-scale=1\'</em> for devices.'),
  72. '#description' => t('This is needed for the responsive menu, if no other theme or module sets the viewport.'),
  73. '#states' => array(
  74. // Hide the settings when the cancel notify checkbox is disabled.
  75. 'visible' => array(
  76. ':input[name="adminimal_admin_menu_slicknav"]' => array('checked' => TRUE),
  77. ),
  78. ),
  79. );
  80. $form = system_settings_form($form);
  81. $form['#submit'][] = 'adminimal_admin_menu_settings_submit';
  82. return $form;
  83. }
  84. /**
  85. * Submit callback for adminimal_admin_menu_settings();
  86. */
  87. function adminimal_admin_menu_settings_submit($form, &$form_state) {
  88. // Clear the admin menu cache.
  89. admin_menu_flush_caches();
  90. }