function NodeTestHooks::nodeUpdate

Implements hook_ENTITY_TYPE_update() for node entities.

File

core/modules/node/tests/modules/node_test/src/Hook/NodeTestHooks.php, line 154

Class

NodeTestHooks
Hook implementations for node_test.

Namespace

Drupal\node_test\Hook

Code

public function nodeUpdate(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.