admin_theme.api.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. // $Id: admin_theme.api.php,v 1.1.2.1 2008/12/13 09:47:29 davyvandenbremt Exp $
  3. /**
  4. * @file
  5. * Hooks provided by the Administration theme module.
  6. */
  7. /**
  8. * @addtogroup hooks
  9. * @{
  10. */
  11. /**
  12. * Add more options to the administration theme settings page.
  13. *
  14. * This hook allows modules to add more options to the administration theme
  15. * settings page.
  16. *
  17. * @return
  18. * A linear array of associative arrays. The keys of the linear array are
  19. * the identifiers for the "options" that will be check for in
  20. * hook_admin_theme_check. The associative arrays have keys:
  21. * - "title": The title to display on the checkbox on the administration
  22. * theme settings page.
  23. * - "description": The description to display on the checkbox on the
  24. * administration theme settings page.
  25. */
  26. function hook_admin_theme_info() {
  27. $options = array();
  28. $options['batch'] = array(
  29. 'title' => t('Use administration theme for batch processing'),
  30. 'description' => t('Use the administration theme when executing batch operations.'),
  31. );
  32. if (module_exists('coder')) {
  33. $options['coder'] = array(
  34. 'title' => t('Use administration theme for code reviews'),
  35. 'description' => t('Use the administration theme when viewing Coder code reviews.'),
  36. );
  37. }
  38. if (module_exists('service_attachments')) {
  39. $options['service_attachments'] = array(
  40. 'title' => t('Use administration theme for viewing the service attachments form on nodes.'),
  41. 'description' => t('Use the administration theme when viewing service attachments on nodes.'),
  42. );
  43. }
  44. if (module_exists('webform')) {
  45. $options['webform_results'] = array(
  46. 'title' => t('Use administration theme for viewing webform submissions.'),
  47. 'description' => t('Use the administration theme when viewing webform submissions.'),
  48. );
  49. }
  50. if (module_exists('statistics')) {
  51. $options['statistics'] = array(
  52. 'title' => t('Use administration theme for viewing pages of the statistics module.'),
  53. 'description' => t('Use the administration theme when viewing pages of the statistics module.'),
  54. );
  55. }
  56. return $options;
  57. }
  58. /**
  59. * Check if an option is "on" for the current page.
  60. *
  61. * This hook allows modules to check for each option defined in
  62. * hook_admin_theme_info if the option is "on".
  63. *
  64. * @param
  65. * $option. The option to check.
  66. * @return
  67. * TRUE or FALSE indicating if the administration theme should be used.
  68. */
  69. function hook_admin_theme_check($option = NULL) {
  70. switch ($option) {
  71. case 'coder':
  72. return arg(0) == 'coder';
  73. case 'batch':
  74. return arg(0) == 'batch';
  75. case 'service_attachments':
  76. return arg(0) == 'node' && arg(2) == 'service_attachments';
  77. case 'webform_results':
  78. return arg(0) == 'node' && arg(2) == 'webform-results';
  79. case 'statistics':
  80. return (arg(0) == 'node' || arg(0) == 'user') && arg(2) == 'track';
  81. }
  82. }
  83. /**
  84. * @} End of "addtogroup hooks".
  85. */