function node_test_node_update

Same name in other branches
  1. 7.x modules/node/tests/node_test.module \node_test_node_update()
  2. 9 core/modules/node/tests/modules/node_test/node_test.module \node_test_node_update()
  3. 8.9.x core/modules/node/tests/modules/node_test/node_test.module \node_test_node_update()
  4. 10 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

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';
        }
    }
}

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