entity_crud_hook_test.module

Same filename in other branches
  1. 9 core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
  2. 8.9.x core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
  3. 10 core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
  4. 11.x core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module

Test module for the Entity CRUD API.

File

modules/simpletest/tests/entity_crud_hook_test.module

View source
<?php


/**
 * @file
 * Test module for the Entity CRUD API.
 */

/**
 * Implements hook_entity_presave().
 */
function entity_crud_hook_test_entity_presave($entity, $type) {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}

/**
 * Implements hook_comment_presave().
 */
function entity_crud_hook_test_comment_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_file_presave().
 */
function entity_crud_hook_test_file_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_node_presave().
 */
function entity_crud_hook_test_node_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_term_presave().
 */
function entity_crud_hook_test_taxonomy_term_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_vocabulary_presave().
 */
function entity_crud_hook_test_taxonomy_vocabulary_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_user_presave().
 */
function entity_crud_hook_test_user_presave() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_entity_insert().
 */
function entity_crud_hook_test_entity_insert($entity, $type) {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}

/**
 * Implements hook_comment_insert().
 */
function entity_crud_hook_test_comment_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_file_insert().
 */
function entity_crud_hook_test_file_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_node_insert().
 */
function entity_crud_hook_test_node_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_term_insert().
 */
function entity_crud_hook_test_taxonomy_term_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_vocabulary_insert().
 */
function entity_crud_hook_test_taxonomy_vocabulary_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_user_insert().
 */
function entity_crud_hook_test_user_insert() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_entity_load().
 */
function entity_crud_hook_test_entity_load(array $entities, $type) {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}

/**
 * Implements hook_comment_load().
 */
function entity_crud_hook_test_comment_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_file_load().
 */
function entity_crud_hook_test_file_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_node_load().
 */
function entity_crud_hook_test_node_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_term_load().
 */
function entity_crud_hook_test_taxonomy_term_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_vocabulary_load().
 */
function entity_crud_hook_test_taxonomy_vocabulary_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_user_load().
 */
function entity_crud_hook_test_user_load() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_entity_update().
 */
function entity_crud_hook_test_entity_update($entity, $type) {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}

/**
 * Implements hook_comment_update().
 */
function entity_crud_hook_test_comment_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_file_update().
 */
function entity_crud_hook_test_file_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_node_update().
 */
function entity_crud_hook_test_node_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_term_update().
 */
function entity_crud_hook_test_taxonomy_term_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_vocabulary_update().
 */
function entity_crud_hook_test_taxonomy_vocabulary_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_user_update().
 */
function entity_crud_hook_test_user_update() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_entity_delete().
 */
function entity_crud_hook_test_entity_delete($entity, $type) {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called for type ' . $type;
}

/**
 * Implements hook_comment_delete().
 */
function entity_crud_hook_test_comment_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_file_delete().
 */
function entity_crud_hook_test_file_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_node_delete().
 */
function entity_crud_hook_test_node_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_term_delete().
 */
function entity_crud_hook_test_taxonomy_term_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_taxonomy_vocabulary_delete().
 */
function entity_crud_hook_test_taxonomy_vocabulary_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_user_delete().
 */
function entity_crud_hook_test_user_delete() {
    $_SESSION['entity_crud_hook_test'][] = __FUNCTION__ . ' called';
}

/**
 * Implements hook_entity_info_alter().
 */
function entity_crud_hook_test_entity_info_alter(&$entity_info) {
    if (variable_get('entity_crud_hook_test_alter_controller_class', FALSE)) {
        // Set the controller class for nodes to NULL.
        $entity_info['node']['controller class'] = NULL;
    }
}

Functions

Title Deprecated Summary
entity_crud_hook_test_comment_delete Implements hook_comment_delete().
entity_crud_hook_test_comment_insert Implements hook_comment_insert().
entity_crud_hook_test_comment_load Implements hook_comment_load().
entity_crud_hook_test_comment_presave Implements hook_comment_presave().
entity_crud_hook_test_comment_update Implements hook_comment_update().
entity_crud_hook_test_entity_delete Implements hook_entity_delete().
entity_crud_hook_test_entity_info_alter Implements hook_entity_info_alter().
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_presave Implements hook_entity_presave().
entity_crud_hook_test_entity_update Implements hook_entity_update().
entity_crud_hook_test_file_delete Implements hook_file_delete().
entity_crud_hook_test_file_insert Implements hook_file_insert().
entity_crud_hook_test_file_load Implements hook_file_load().
entity_crud_hook_test_file_presave Implements hook_file_presave().
entity_crud_hook_test_file_update Implements hook_file_update().
entity_crud_hook_test_node_delete Implements hook_node_delete().
entity_crud_hook_test_node_insert Implements hook_node_insert().
entity_crud_hook_test_node_load Implements hook_node_load().
entity_crud_hook_test_node_presave Implements hook_node_presave().
entity_crud_hook_test_node_update Implements hook_node_update().
entity_crud_hook_test_taxonomy_term_delete Implements hook_taxonomy_term_delete().
entity_crud_hook_test_taxonomy_term_insert Implements hook_taxonomy_term_insert().
entity_crud_hook_test_taxonomy_term_load Implements hook_taxonomy_term_load().
entity_crud_hook_test_taxonomy_term_presave Implements hook_taxonomy_term_presave().
entity_crud_hook_test_taxonomy_term_update Implements hook_taxonomy_term_update().
entity_crud_hook_test_taxonomy_vocabulary_delete Implements hook_taxonomy_vocabulary_delete().
entity_crud_hook_test_taxonomy_vocabulary_insert Implements hook_taxonomy_vocabulary_insert().
entity_crud_hook_test_taxonomy_vocabulary_load Implements hook_taxonomy_vocabulary_load().
entity_crud_hook_test_taxonomy_vocabulary_presave Implements hook_taxonomy_vocabulary_presave().
entity_crud_hook_test_taxonomy_vocabulary_update Implements hook_taxonomy_vocabulary_update().
entity_crud_hook_test_user_delete Implements hook_user_delete().
entity_crud_hook_test_user_insert Implements hook_user_insert().
entity_crud_hook_test_user_load Implements hook_user_load().
entity_crud_hook_test_user_presave Implements hook_user_presave().
entity_crud_hook_test_user_update Implements hook_user_update().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.