skinr_test.module 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * @file
  4. * Skinr testing module.
  5. *
  6. * Other modules should be able to place their Skinr support/integration code
  7. * into a conditionally loaded $module.skinr.inc file, so this .module file
  8. * only exists, because Drupal requires a .module file to exist.
  9. */
  10. /**
  11. * Implements hook_menu().
  12. */
  13. function skinr_test_menu() {
  14. $items['skinr-test/hook-dynamic-loading'] = array(
  15. 'title' => 'Test hook dynamic loading (skinr_hook)',
  16. 'page callback' => 'skinr_test_hook_dynamic_loading',
  17. 'access arguments' => array('access content'),
  18. );
  19. return $items;
  20. }
  21. /**
  22. * Page callback for 'hook dynamic loading' test.
  23. *
  24. * If the hook is dynamically loaded correctly, the menu callback should
  25. * return 'success!'.
  26. */
  27. function skinr_test_hook_dynamic_loading() {
  28. if (skinr_hook('skinr_test', 'skinr_group_info') && function_exists('skinr_test_skinr_group_info')) {
  29. return 'success!';
  30. }
  31. return 'failed!';
  32. }
  33. /**
  34. * Implements hook_system_theme_info().
  35. *
  36. * @see http://drupal.org/node/953336
  37. */
  38. function skinr_test_system_theme_info() {
  39. $path = drupal_get_path('module', 'skinr_test');
  40. $test_themes = array('basetheme', 'subtheme', 'basetheme_other', 'subtheme_other');
  41. foreach ($test_themes as $theme) {
  42. $themes["skinr_test_{$theme}"] = $path . "/themes/skinr_test_{$theme}/skinr_test_{$theme}.info";
  43. }
  44. return $themes;
  45. }
  46. //
  47. // Presave hooks
  48. //
  49. /**
  50. * Implements hook_skinr_skin_presave().
  51. */
  52. function skinr_test_skinr_skin_presave() {
  53. $_SESSION['skinr_test'][] = (__FUNCTION__ . ' called');
  54. }
  55. //
  56. // Insert hooks
  57. //
  58. /**
  59. * Implements hook_skinr_skin_insert().
  60. */
  61. function skinr_test_skinr_skin_insert() {
  62. $_SESSION['skinr_test'][] = (__FUNCTION__ . ' called');
  63. }
  64. //
  65. // Load hooks
  66. //
  67. /**
  68. * Implements hook_skinr_skin_load().
  69. */
  70. function skinr_test_skinr_skin_load() {
  71. $_SESSION['skinr_test'][] = (__FUNCTION__ . ' called');
  72. }
  73. //
  74. // Update hooks
  75. //
  76. /**
  77. * Implements hook_skinr_skin_update().
  78. */
  79. function skinr_test_skinr_skin_update() {
  80. $_SESSION['skinr_test'][] = (__FUNCTION__ . ' called');
  81. }
  82. //
  83. // Delete hooks
  84. //
  85. /**
  86. * Implements hook_skinr_skin_delete().
  87. */
  88. function skinr_test_skinr_skin_delete() {
  89. $_SESSION['skinr_test'][] = (__FUNCTION__ . ' called');
  90. }