admin_theme.install 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function admin_theme_install() {
  6. // Updating module weight to 10 to make it run after system.
  7. // (For user access checks etc.)
  8. db_query("UPDATE {system} SET weight = 10 WHERE name = 'admin_theme'");
  9. $link = array('!link' => l(t('Administer > Appearance > Administration theme'), 'admin/appearance'));
  10. drupal_set_message(t("Administration theme module settings are available under !link", $link));
  11. }
  12. /**
  13. * Implementation of hook_uninstall().
  14. */
  15. function admin_theme_uninstall() {
  16. // Cleaning up general admin theme variables.
  17. variable_del('admin_theme_path');
  18. variable_del('admin_theme_path_disallow');
  19. // Cleaning up module defined admin theme variables.
  20. // We need to add admin theme's explicitly,
  21. // because it's not in the list of modules anymore.
  22. drupal_load('module', 'admin_theme');
  23. $admin_theme_options = admin_theme_admin_theme_info();
  24. $options = array();
  25. foreach ($admin_theme_options as $option => $info) {
  26. $info['option'] = $option;
  27. $info['module'] = 'admin_theme';
  28. $options[] = $info;
  29. }
  30. // Merging admin theme's options with other module options.
  31. // @fixme Does this work if other modules are also uninstalled simultaneously?
  32. $list = array_merge(admin_theme_list(), $options);
  33. // Deleting the module defined variables.
  34. foreach ($list as $info) {
  35. $var = admin_theme_variable_name($info['module'], $info['option']);
  36. variable_del($var);
  37. }
  38. }