node_test_exception.module

Same filename in other branches
  1. 7.x modules/node/tests/node_test_exception.module
  2. 9 core/modules/node/tests/modules/node_test_exception/node_test_exception.module
  3. 8.9.x core/modules/node/tests/modules/node_test_exception/node_test_exception.module
  4. 11.x core/modules/node/tests/modules/node_test_exception/node_test_exception.module

A module implementing node related hooks to test API interaction.

File

core/modules/node/tests/modules/node_test_exception/node_test_exception.module

View source
<?php


/**
 * @file
 * A module implementing node related hooks to test API interaction.
 */
use Drupal\node\NodeInterface;

/**
 * Implements hook_ENTITY_TYPE_insert() for node entities.
 */
function node_test_exception_node_insert(NodeInterface $node) {
    if ($node->getTitle() == 'testing_transaction_exception') {
        throw new Exception('Test exception for rollback.');
    }
}

Functions

Title Deprecated Summary
node_test_exception_node_insert Implements hook_ENTITY_TYPE_insert() for node entities.

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