1 node_test.module node_test_node_presave(Node $node)

Implements hook_node_presave().

File

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

Code

function node_test_node_presave(Node $node) {
  if ($node->title == 'testing_node_presave') {
    // Backdrop v1.0.0 release.
    $node->created = 1421394600;
    // Backdrop v1.5.0 release.
    $node->changed = 1474011660;
  }
  // Determine changes.
  if (!empty($node->original) && $node->original->title == 'test_changes') {
    if ($node->original->title != $node->title) {
      $node->title .= '_presave';
    }
  }
}