admin_theme.api.php 2.8 KB

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