Projet

Général

Profil

Paste
Télécharger (3,05 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / adminimal_admin_menu / adminimal_admin_menu.install @ 87dbc3bf

1 87dbc3bf Benjamin Luce
<?php
2
3
/**
4
 * @file
5
 * Performs installation functions.
6
 */
7
8
/**
9
 * Implements hook_enable().
10
 */
11
function adminimal_admin_menu_enable() {
12
13
  // Check if core "toolbar" module is enabled.
14
  if (module_exists('toolbar')) {
15
16
    // Disable the core "toolbar" module to avoid double menu rendering.
17
    module_disable(array('toolbar'), FALSE);
18
19
    // Display message to the administrator that the module is disabled.
20
    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');
21
22
    // Let the database know that the module was disabled.
23
    variable_set('adminimal_admin_menu_core-toolbar-disabled', TRUE);
24
25
  }
26
27
  // Check if Admin Toolbar theme is enabled.
28
  if (module_exists('admin_menu_toolbar')) {
29
30
    // Disable the admin menu toolbar theme to avoid style issues.
31
    module_disable(array('admin_menu_toolbar'), FALSE);
32
33
    // Display message to the administrator that the module is disabled.
34
    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');
35
36
    // Let the database know that the module was disabled.
37
    variable_set('adminimal_admin_menu_toolbar-disabled', TRUE);
38
39
  }
40
}
41
42
/**
43
 * Implements hook_disable().
44
 */
45
function adminimal_admin_menu_disable() {
46
47
  // Check if core "Toolbar" module was disabled by adminimal menu.
48
  if (variable_get('adminimal_admin_menu_core-toolbar-disabled', FALSE)) {
49
50
    // If true, re-enable the "Administration menu Toolbar style" module.
51
    module_enable(array('toolbar'), FALSE);
52
53
    // Display message to the administrator that the module is disabled.
54
    drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully disabled!<br />The core "Toolbar" module  was automatically re-enabled.'), 'status');
55
56
  }
57
58
  // Check if "Administration menu Toolbar style" was disabled by this module.
59
  if (variable_get('adminimal_admin_menu_toolbar-disabled', FALSE)) {
60
61
    // If true, re-enable the "Administration menu Toolbar style" module.
62
    module_enable(array('admin_menu_toolbar'), FALSE);
63
64
    // Display message to the administrator that the module is disabled.
65
    drupal_set_message(t('<strong>Administration menu Adminimal Theme</strong> module successfully disabled!<br />The old Toolbar theme was automatically re-enabled.'), 'status');
66
67
  }
68
}
69
70
/**
71
 * Implements hook_uninstall().
72
 */
73
function adminimal_admin_menu_uninstall() {
74
75
  // Clean up the module variables from database after uninstall.
76
  variable_del('adminimal_admin_menu_toolbar-disabled');
77
  variable_del('adminimal_admin_menu_core-toolbar-disabled');
78
  variable_del('adminimal_admin_menu_render');
79
80
}