admin_theme.install 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // $Id: admin_theme.install,v 1.1.2.2.4.4 2009/10/20 18:25:45 davyvandenbremt Exp $
  3. /**
  4. * Implementation of hook_install().
  5. */
  6. function admin_theme_install() {
  7. // updating module weight to 10 to make it run after system (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 because it's not in the list of modules anymore
  21. $admin_theme_options = admin_theme_admin_theme_info();
  22. $options = array();
  23. foreach ($admin_theme_options as $option => $info) {
  24. $info['option'] = $option;
  25. $info['module'] = 'admin_theme';
  26. $options[] = $info;
  27. }
  28. // mergin admin theme's options with other module options
  29. // @fixme does this work if other modules are also uninstalled at the same time?
  30. $list = array_merge(admin_theme_list(), $options);
  31. // deleting the module defined variables
  32. foreach ($list as $info) {
  33. $var = admin_theme_variable_name($info['module'], $info['option']);
  34. variable_del($var);
  35. }
  36. }