5 * Test module for the Entity CRUD API.
8 use Drupal\Core\Entity\EntityInterface;
11 * Implements hook_entity_create().
13 function entity_crud_hook_test_entity_create(EntityInterface $entity) {
14 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
18 * Implements hook_ENTITY_TYPE_create() for block entities.
20 function entity_crud_hook_test_block_create() {
21 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
25 * Implements hook_ENTITY_TYPE_create() for comment entities.
27 function entity_crud_hook_test_comment_create() {
28 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
32 * Implements hook_ENTITY_TYPE_create() for file entities.
34 function entity_crud_hook_test_file_create() {
35 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
39 * Implements hook_ENTITY_TYPE_create() for node entities.
41 function entity_crud_hook_test_node_create() {
42 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
46 * Implements hook_ENTITY_TYPE_create() for taxonomy_term entities.
48 function entity_crud_hook_test_taxonomy_term_create() {
49 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
53 * Implements hook_ENTITY_TYPE_create() for taxonomy_vocabulary entities.
55 function entity_crud_hook_test_taxonomy_vocabulary_create() {
56 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
60 * Implements hook_ENTITY_TYPE_create() for user entities.
62 function entity_crud_hook_test_user_create() {
63 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
67 * Implements hook_entity_presave().
69 function entity_crud_hook_test_entity_presave(EntityInterface $entity) {
70 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
74 * Implements hook_ENTITY_TYPE_presave() for block entities.
76 function entity_crud_hook_test_block_presave() {
77 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
81 * Implements hook_ENTITY_TYPE_presave() for comment entities.
83 function entity_crud_hook_test_comment_presave() {
84 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
88 * Implements hook_ENTITY_TYPE_presave() for file entities.
90 function entity_crud_hook_test_file_presave() {
91 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
95 * Implements hook_ENTITY_TYPE_presave() for node entities.
97 function entity_crud_hook_test_node_presave() {
98 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
102 * Implements hook_ENTITY_TYPE_presave() for taxonomy_term entities.
104 function entity_crud_hook_test_taxonomy_term_presave() {
105 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
109 * Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
111 function entity_crud_hook_test_taxonomy_vocabulary_presave() {
112 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
116 * Implements hook_ENTITY_TYPE_presave() for user entities.
118 function entity_crud_hook_test_user_presave() {
119 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
123 * Implements hook_entity_insert().
125 function entity_crud_hook_test_entity_insert(EntityInterface $entity) {
126 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
130 * Implements hook_ENTITY_TYPE_insert() for block entities.
132 function entity_crud_hook_test_block_insert() {
133 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
137 * Implements hook_ENTITY_TYPE_insert() for comment entities.
139 function entity_crud_hook_test_comment_insert() {
140 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
144 * Implements hook_ENTITY_TYPE_insert() for file entities.
146 function entity_crud_hook_test_file_insert() {
147 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
151 * Implements hook_ENTITY_TYPE_insert() for node entities.
153 function entity_crud_hook_test_node_insert() {
154 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
158 * Implements hook_ENTITY_TYPE_insert() for taxonomy_term entities.
160 function entity_crud_hook_test_taxonomy_term_insert() {
161 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
165 * Implements hook_ENTITY_TYPE_insert() for taxonomy_vocabulary entities.
167 function entity_crud_hook_test_taxonomy_vocabulary_insert() {
168 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
172 * Implements hook_ENTITY_TYPE_insert() for user entities.
174 function entity_crud_hook_test_user_insert() {
175 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
179 * Implements hook_entity_load().
181 function entity_crud_hook_test_entity_load(array $entities, $type) {
182 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
186 * Implements hook_ENTITY_TYPE_load() for block entities.
188 function entity_crud_hook_test_block_load() {
189 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
193 * Implements hook_ENTITY_TYPE_load() for comment entities.
195 function entity_crud_hook_test_comment_load() {
196 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
200 * Implements hook_ENTITY_TYPE_load() for file entities.
202 function entity_crud_hook_test_file_load() {
203 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
207 * Implements hook_ENTITY_TYPE_load() for node entities.
209 function entity_crud_hook_test_node_load() {
210 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
214 * Implements hook_ENTITY_TYPE_load() for taxonomy_term entities.
216 function entity_crud_hook_test_taxonomy_term_load() {
217 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
221 * Implements hook_ENTITY_TYPE_load() for taxonomy_vocabulary entities.
223 function entity_crud_hook_test_taxonomy_vocabulary_load() {
224 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
228 * Implements hook_ENTITY_TYPE_load() for user entities.
230 function entity_crud_hook_test_user_load() {
231 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
235 * Implements hook_entity_update().
237 function entity_crud_hook_test_entity_update(EntityInterface $entity) {
238 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
242 * Implements hook_ENTITY_TYPE_update() for block entities.
244 function entity_crud_hook_test_block_update() {
245 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
249 * Implements hook_ENTITY_TYPE_update() for comment entities.
251 function entity_crud_hook_test_comment_update() {
252 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
256 * Implements hook_ENTITY_TYPE_update() for file entities.
258 function entity_crud_hook_test_file_update() {
259 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
263 * Implements hook_ENTITY_TYPE_update() for node entities.
265 function entity_crud_hook_test_node_update() {
266 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
270 * Implements hook_ENTITY_TYPE_update() for taxonomy_term entities.
272 function entity_crud_hook_test_taxonomy_term_update() {
273 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
277 * Implements hook_ENTITY_TYPE_update() for taxonomy_vocabulary entities.
279 function entity_crud_hook_test_taxonomy_vocabulary_update() {
280 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
284 * Implements hook_ENTITY_TYPE_update() for user entities.
286 function entity_crud_hook_test_user_update() {
287 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
291 * Implements hook_entity_predelete().
293 function entity_crud_hook_test_entity_predelete(EntityInterface $entity) {
294 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
298 * Implements hook_ENTITY_TYPE_predelete() for block entities.
300 function entity_crud_hook_test_block_predelete() {
301 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
305 * Implements hook_ENTITY_TYPE_predelete() for comment entities.
307 function entity_crud_hook_test_comment_predelete() {
308 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
312 * Implements hook_ENTITY_TYPE_predelete() for file entities.
314 function entity_crud_hook_test_file_predelete() {
315 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
319 * Implements hook_ENTITY_TYPE_predelete() for node entities.
321 function entity_crud_hook_test_node_predelete() {
322 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
326 * Implements hook_ENTITY_TYPE_predelete() for taxonomy_term entities.
328 function entity_crud_hook_test_taxonomy_term_predelete() {
329 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
333 * Implements hook_ENTITY_TYPE_predelete() for taxonomy_vocabulary entities.
335 function entity_crud_hook_test_taxonomy_vocabulary_predelete() {
336 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
340 * Implements hook_ENTITY_TYPE_predelete() for user entities.
342 function entity_crud_hook_test_user_predelete() {
343 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
347 * Implements hook_entity_delete().
349 function entity_crud_hook_test_entity_delete(EntityInterface $entity) {
350 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $entity->getEntityTypeId());
354 * Implements hook_ENTITY_TYPE_delete() for block entities.
356 function entity_crud_hook_test_block_delete() {
357 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
361 * Implements hook_ENTITY_TYPE_delete() for comment entities.
363 function entity_crud_hook_test_comment_delete() {
364 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
368 * Implements hook_ENTITY_TYPE_delete() for file entities.
370 function entity_crud_hook_test_file_delete() {
371 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
375 * Implements hook_ENTITY_TYPE_delete() for node entities.
377 function entity_crud_hook_test_node_delete() {
378 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
382 * Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities.
384 function entity_crud_hook_test_taxonomy_term_delete() {
385 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
389 * Implements hook_ENTITY_TYPE_delete() for taxonomy_vocabulary entities.
391 function entity_crud_hook_test_taxonomy_vocabulary_delete() {
392 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
396 * Implements hook_ENTITY_TYPE_delete() for user entities.
398 function entity_crud_hook_test_user_delete() {
399 $GLOBALS['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');