function NodeTestExceptionHooks::nodeInsert
Implements hook_ENTITY_TYPE_insert() for node entities.
File
-
core/
modules/ node/ tests/ modules/ node_test_exception/ src/ Hook/ NodeTestExceptionHooks.php, line 18
Class
- NodeTestExceptionHooks
- Hook implementations for node_test_exception.
Namespace
Drupal\node_test_exception\HookCode
public function nodeInsert(NodeInterface $node) {
if ($node->getTitle() == 'testing_transaction_exception') {
throw new \Exception('Test exception for rollback.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.