adminimal_admin_menu.install 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * @file
  4. * Performs installation functions.
  5. */
  6. /**
  7. * Implements hook_enable().
  8. */
  9. function adminimal_admin_menu_enable() {
  10. // Check if core "toolbar" module is enabled.
  11. if (module_exists('toolbar')) {
  12. // Disable the core "toolbar" module to avoid double menu rendering.
  13. module_disable(array('toolbar'), FALSE);
  14. // Display message to the administrator that the module is disabled.
  15. drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully enabled!<br />The core "Toolbar" module was automatically disabled to avoid double menu rendering. Disabling the Adminimal menu module will automatically re-enable the core toolbar module, so you have nothing to worry about.'), 'status');
  16. // Let the database know that the module was disabled.
  17. variable_set('adminimal_admin_menu_core-toolbar-disabled', TRUE);
  18. }
  19. // Check if Admin Toolbar theme is enabled.
  20. if (module_exists('admin_menu_toolbar')) {
  21. // Disable the admin menu toolbar theme to avoid style issues.
  22. module_disable(array('admin_menu_toolbar'), FALSE);
  23. // Display message to the administrator that the module is disabled.
  24. drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully enabled!<br />Your old Administration menu Toolbar theme was automatically disabled to avoid styling issues. Disabling the Adminimal menu module will automatically re-enable your old toolbar theme, so you have nothing to worry about.'), 'status');
  25. // Let the database know that the module was disabled.
  26. variable_set('adminimal_admin_menu_toolbar-disabled', TRUE);
  27. }
  28. }
  29. /**
  30. * Implements hook_disable().
  31. */
  32. function adminimal_admin_menu_disable() {
  33. // Check if core "Toolbar" module was disabled by adminimal menu.
  34. if (variable_get('adminimal_admin_menu_core-toolbar-disabled', FALSE)) {
  35. // If true, re-enable the "Administration menu Toolbar style" module.
  36. module_enable(array('toolbar'), FALSE);
  37. // Display message to the administrator that the module is disabled.
  38. drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully disabled!<br />The core "Toolbar" module was automatically re-enabled.'), 'status');
  39. }
  40. // Check if "Administration menu Toolbar style" was disabled by this module.
  41. if (variable_get('adminimal_admin_menu_toolbar-disabled', FALSE)) {
  42. // If true, re-enable the "Administration menu Toolbar style" module.
  43. module_enable(array('admin_menu_toolbar'), FALSE);
  44. // Display message to the administrator that the module is disabled.
  45. drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully disabled!<br />The old Toolbar theme was automatically re-enabled.'), 'status');
  46. }
  47. }
  48. /**
  49. * Implements hook_uninstall().
  50. */
  51. function adminimal_admin_menu_uninstall() {
  52. // Clean up the module variables from database after uninstall.
  53. variable_del('adminimal_admin_menu_toolbar-disabled');
  54. variable_del('adminimal_admin_menu_core-toolbar-disabled');
  55. variable_del('adminimal_admin_menu_render');
  56. }
  57. /**
  58. * Clean up some files that are no longer needed.
  59. */
  60. function adminimal_admin_menu_update_7100() {
  61. // Include the update file.
  62. include 'updates/update_7100.php';
  63. }