entity_crud_hook_test.module 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <?php
  2. /**
  3. * @file
  4. * Test module for the Entity CRUD API.
  5. */
  6. /**
  7. * Implements hook_entity_presave().
  8. */
  9. function entity_crud_hook_test_entity_presave($entity, $type) {
  10. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
  11. }
  12. /**
  13. * Implements hook_comment_presave().
  14. */
  15. function entity_crud_hook_test_comment_presave() {
  16. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  17. }
  18. /**
  19. * Implements hook_file_presave().
  20. */
  21. function entity_crud_hook_test_file_presave() {
  22. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  23. }
  24. /**
  25. * Implements hook_node_presave().
  26. */
  27. function entity_crud_hook_test_node_presave() {
  28. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  29. }
  30. /**
  31. * Implements hook_taxonomy_term_presave().
  32. */
  33. function entity_crud_hook_test_taxonomy_term_presave() {
  34. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  35. }
  36. /**
  37. * Implements hook_taxonomy_vocabulary_presave().
  38. */
  39. function entity_crud_hook_test_taxonomy_vocabulary_presave() {
  40. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  41. }
  42. /**
  43. * Implements hook_user_presave().
  44. */
  45. function entity_crud_hook_test_user_presave() {
  46. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  47. }
  48. /**
  49. * Implements hook_entity_insert().
  50. */
  51. function entity_crud_hook_test_entity_insert($entity, $type) {
  52. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
  53. }
  54. /**
  55. * Implements hook_comment_insert().
  56. */
  57. function entity_crud_hook_test_comment_insert() {
  58. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  59. }
  60. /**
  61. * Implements hook_file_insert().
  62. */
  63. function entity_crud_hook_test_file_insert() {
  64. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  65. }
  66. /**
  67. * Implements hook_node_insert().
  68. */
  69. function entity_crud_hook_test_node_insert() {
  70. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  71. }
  72. /**
  73. * Implements hook_taxonomy_term_insert().
  74. */
  75. function entity_crud_hook_test_taxonomy_term_insert() {
  76. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  77. }
  78. /**
  79. * Implements hook_taxonomy_vocabulary_insert().
  80. */
  81. function entity_crud_hook_test_taxonomy_vocabulary_insert() {
  82. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  83. }
  84. /**
  85. * Implements hook_user_insert().
  86. */
  87. function entity_crud_hook_test_user_insert() {
  88. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  89. }
  90. /**
  91. * Implements hook_entity_load().
  92. */
  93. function entity_crud_hook_test_entity_load(array $entities, $type) {
  94. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
  95. }
  96. /**
  97. * Implements hook_comment_load().
  98. */
  99. function entity_crud_hook_test_comment_load() {
  100. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  101. }
  102. /**
  103. * Implements hook_file_load().
  104. */
  105. function entity_crud_hook_test_file_load() {
  106. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  107. }
  108. /**
  109. * Implements hook_node_load().
  110. */
  111. function entity_crud_hook_test_node_load() {
  112. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  113. }
  114. /**
  115. * Implements hook_taxonomy_term_load().
  116. */
  117. function entity_crud_hook_test_taxonomy_term_load() {
  118. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  119. }
  120. /**
  121. * Implements hook_taxonomy_vocabulary_load().
  122. */
  123. function entity_crud_hook_test_taxonomy_vocabulary_load() {
  124. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  125. }
  126. /**
  127. * Implements hook_user_load().
  128. */
  129. function entity_crud_hook_test_user_load() {
  130. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  131. }
  132. /**
  133. * Implements hook_entity_update().
  134. */
  135. function entity_crud_hook_test_entity_update($entity, $type) {
  136. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
  137. }
  138. /**
  139. * Implements hook_comment_update().
  140. */
  141. function entity_crud_hook_test_comment_update() {
  142. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  143. }
  144. /**
  145. * Implements hook_file_update().
  146. */
  147. function entity_crud_hook_test_file_update() {
  148. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  149. }
  150. /**
  151. * Implements hook_node_update().
  152. */
  153. function entity_crud_hook_test_node_update() {
  154. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  155. }
  156. /**
  157. * Implements hook_taxonomy_term_update().
  158. */
  159. function entity_crud_hook_test_taxonomy_term_update() {
  160. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  161. }
  162. /**
  163. * Implements hook_taxonomy_vocabulary_update().
  164. */
  165. function entity_crud_hook_test_taxonomy_vocabulary_update() {
  166. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  167. }
  168. /**
  169. * Implements hook_user_update().
  170. */
  171. function entity_crud_hook_test_user_update() {
  172. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  173. }
  174. /**
  175. * Implements hook_entity_delete().
  176. */
  177. function entity_crud_hook_test_entity_delete($entity, $type) {
  178. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
  179. }
  180. /**
  181. * Implements hook_comment_delete().
  182. */
  183. function entity_crud_hook_test_comment_delete() {
  184. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  185. }
  186. /**
  187. * Implements hook_file_delete().
  188. */
  189. function entity_crud_hook_test_file_delete() {
  190. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  191. }
  192. /**
  193. * Implements hook_node_delete().
  194. */
  195. function entity_crud_hook_test_node_delete() {
  196. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  197. }
  198. /**
  199. * Implements hook_taxonomy_term_delete().
  200. */
  201. function entity_crud_hook_test_taxonomy_term_delete() {
  202. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  203. }
  204. /**
  205. * Implements hook_taxonomy_vocabulary_delete().
  206. */
  207. function entity_crud_hook_test_taxonomy_vocabulary_delete() {
  208. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  209. }
  210. /**
  211. * Implements hook_user_delete().
  212. */
  213. function entity_crud_hook_test_user_delete() {
  214. $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
  215. }