You are here

function node_test_node_update in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/tests/modules/node_test/node_test.module \node_test_node_update()
  2. 7 modules/node/tests/node_test.module \node_test_node_update()
  3. 9 core/modules/node/tests/modules/node_test/node_test.module \node_test_node_update()

Implements hook_ENTITY_TYPE_update() for node entities.

File

core/modules/node/tests/modules/node_test/node_test.module, line 147
A dummy module for testing node related hooks.

Code

function node_test_node_update(NodeInterface $node) {

  // Determine changes on update.
  if (!empty($node->original) && $node->original
    ->getTitle() == 'test_changes') {
    if ($node->original
      ->getTitle() != $node
      ->getTitle()) {
      $node->title->value .= '_update';
    }
  }
}