entity_crud_hook_test.module
Same filename in other branches
- 7.x modules/simpletest/tests/entity_crud_hook_test.module
- 8.9.x core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
- 10 core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
- 11.x core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Test module for the Entity CRUD API.
File
-
core/
modules/ system/ tests/ modules/ entity_crud_hook_test/ entity_crud_hook_test.module
View source
<?php
/**
* @file
* Test module for the Entity CRUD API.
*/
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_entity_create().
*/
function entity_crud_hook_test_entity_create(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_create() for block entities.
*/
function entity_crud_hook_test_block_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for comment entities.
*/
function entity_crud_hook_test_comment_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for file entities.
*/
function entity_crud_hook_test_file_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for node entities.
*/
function entity_crud_hook_test_node_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_create() for user entities.
*/
function entity_crud_hook_test_user_create() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_presave().
*/
function entity_crud_hook_test_entity_presave(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_presave() for block entities.
*/
function entity_crud_hook_test_block_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for comment entities.
*/
function entity_crud_hook_test_comment_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for file entities.
*/
function entity_crud_hook_test_file_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for node entities.
*/
function entity_crud_hook_test_node_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_presave() for user entities.
*/
function entity_crud_hook_test_user_presave() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_insert().
*/
function entity_crud_hook_test_entity_insert(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_insert() for block entities.
*/
function entity_crud_hook_test_block_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for comment entities.
*/
function entity_crud_hook_test_comment_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for file entities.
*/
function entity_crud_hook_test_file_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for node entities.
*/
function entity_crud_hook_test_node_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_insert() for user entities.
*/
function entity_crud_hook_test_user_insert() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_preload().
*/
function entity_crud_hook_test_entity_preload(array $entities, $type) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}
/**
* Implements hook_entity_load().
*/
function entity_crud_hook_test_entity_load(array $entities, $type) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}
/**
* Implements hook_ENTITY_TYPE_load() for block entities.
*/
function entity_crud_hook_test_block_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for comment entities.
*/
function entity_crud_hook_test_comment_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for file entities.
*/
function entity_crud_hook_test_file_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for node entities.
*/
function entity_crud_hook_test_node_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_load() for user entities.
*/
function entity_crud_hook_test_user_load() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_update().
*/
function entity_crud_hook_test_entity_update(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_update() for block entities.
*/
function entity_crud_hook_test_block_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for comment entities.
*/
function entity_crud_hook_test_comment_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for file entities.
*/
function entity_crud_hook_test_file_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for node entities.
*/
function entity_crud_hook_test_node_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_update() for user entities.
*/
function entity_crud_hook_test_user_update() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_predelete().
*/
function entity_crud_hook_test_entity_predelete(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_predelete() for block entities.
*/
function entity_crud_hook_test_block_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for comment entities.
*/
function entity_crud_hook_test_comment_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for file entities.
*/
function entity_crud_hook_test_file_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for node entities.
*/
function entity_crud_hook_test_node_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_predelete() for user entities.
*/
function entity_crud_hook_test_user_predelete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_entity_delete().
*/
function entity_crud_hook_test_entity_delete(EntityInterface $entity) {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $entity->getEntityTypeId();
}
/**
* Implements hook_ENTITY_TYPE_delete() for block entities.
*/
function entity_crud_hook_test_block_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for comment entities.
*/
function entity_crud_hook_test_comment_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for file entities.
*/
function entity_crud_hook_test_file_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for node entities.
*/
function entity_crud_hook_test_node_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities.
*/
function entity_crud_hook_test_taxonomy_term_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for taxonomy_vocabulary entities.
*/
function entity_crud_hook_test_taxonomy_vocabulary_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
/**
* Implements hook_ENTITY_TYPE_delete() for user entities.
*/
function entity_crud_hook_test_user_delete() {
$GLOBALS['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}
Functions
Title | Deprecated | Summary |
---|---|---|
entity_crud_hook_test_block_create | Implements hook_ENTITY_TYPE_create() for block entities. | |
entity_crud_hook_test_block_delete | Implements hook_ENTITY_TYPE_delete() for block entities. | |
entity_crud_hook_test_block_insert | Implements hook_ENTITY_TYPE_insert() for block entities. | |
entity_crud_hook_test_block_load | Implements hook_ENTITY_TYPE_load() for block entities. | |
entity_crud_hook_test_block_predelete | Implements hook_ENTITY_TYPE_predelete() for block entities. | |
entity_crud_hook_test_block_presave | Implements hook_ENTITY_TYPE_presave() for block entities. | |
entity_crud_hook_test_block_update | Implements hook_ENTITY_TYPE_update() for block entities. | |
entity_crud_hook_test_comment_create | Implements hook_ENTITY_TYPE_create() for comment entities. | |
entity_crud_hook_test_comment_delete | Implements hook_ENTITY_TYPE_delete() for comment entities. | |
entity_crud_hook_test_comment_insert | Implements hook_ENTITY_TYPE_insert() for comment entities. | |
entity_crud_hook_test_comment_load | Implements hook_ENTITY_TYPE_load() for comment entities. | |
entity_crud_hook_test_comment_predelete | Implements hook_ENTITY_TYPE_predelete() for comment entities. | |
entity_crud_hook_test_comment_presave | Implements hook_ENTITY_TYPE_presave() for comment entities. | |
entity_crud_hook_test_comment_update | Implements hook_ENTITY_TYPE_update() for comment entities. | |
entity_crud_hook_test_entity_create | Implements hook_entity_create(). | |
entity_crud_hook_test_entity_delete | Implements hook_entity_delete(). | |
entity_crud_hook_test_entity_insert | Implements hook_entity_insert(). | |
entity_crud_hook_test_entity_load | Implements hook_entity_load(). | |
entity_crud_hook_test_entity_predelete | Implements hook_entity_predelete(). | |
entity_crud_hook_test_entity_preload | Implements hook_entity_preload(). | |
entity_crud_hook_test_entity_presave | Implements hook_entity_presave(). | |
entity_crud_hook_test_entity_update | Implements hook_entity_update(). | |
entity_crud_hook_test_file_create | Implements hook_ENTITY_TYPE_create() for file entities. | |
entity_crud_hook_test_file_delete | Implements hook_ENTITY_TYPE_delete() for file entities. | |
entity_crud_hook_test_file_insert | Implements hook_ENTITY_TYPE_insert() for file entities. | |
entity_crud_hook_test_file_load | Implements hook_ENTITY_TYPE_load() for file entities. | |
entity_crud_hook_test_file_predelete | Implements hook_ENTITY_TYPE_predelete() for file entities. | |
entity_crud_hook_test_file_presave | Implements hook_ENTITY_TYPE_presave() for file entities. | |
entity_crud_hook_test_file_update | Implements hook_ENTITY_TYPE_update() for file entities. | |
entity_crud_hook_test_node_create | Implements hook_ENTITY_TYPE_create() for node entities. | |
entity_crud_hook_test_node_delete | Implements hook_ENTITY_TYPE_delete() for node entities. | |
entity_crud_hook_test_node_insert | Implements hook_ENTITY_TYPE_insert() for node entities. | |
entity_crud_hook_test_node_load | Implements hook_ENTITY_TYPE_load() for node entities. | |
entity_crud_hook_test_node_predelete | Implements hook_ENTITY_TYPE_predelete() for node entities. | |
entity_crud_hook_test_node_presave | Implements hook_ENTITY_TYPE_presave() for node entities. | |
entity_crud_hook_test_node_update | Implements hook_ENTITY_TYPE_update() for node entities. | |
entity_crud_hook_test_taxonomy_term_create | Implements hook_ENTITY_TYPE_create() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_delete | Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_insert | Implements hook_ENTITY_TYPE_insert() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_load | Implements hook_ENTITY_TYPE_load() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_predelete | Implements hook_ENTITY_TYPE_predelete() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_presave | Implements hook_ENTITY_TYPE_presave() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_term_update | Implements hook_ENTITY_TYPE_update() for taxonomy_term entities. | |
entity_crud_hook_test_taxonomy_vocabulary_create | Implements hook_ENTITY_TYPE_create() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_delete | Implements hook_ENTITY_TYPE_delete() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_insert | Implements hook_ENTITY_TYPE_insert() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_load | Implements hook_ENTITY_TYPE_load() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_predelete | Implements hook_ENTITY_TYPE_predelete() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_presave | Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities. | |
entity_crud_hook_test_taxonomy_vocabulary_update | Implements hook_ENTITY_TYPE_update() for taxonomy_vocabulary entities. |
Pagination
- Page 1
- Next page
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.