function node_test_node_presave

Same name in other branches
  1. 9 core/modules/node/tests/modules/node_test/node_test.module \node_test_node_presave()
  2. 8.9.x core/modules/node/tests/modules/node_test/node_test.module \node_test_node_presave()
  3. 10 core/modules/node/tests/modules/node_test/node_test.module \node_test_node_presave()
  4. 11.x core/modules/node/tests/modules/node_test/node_test.module \node_test_node_presave()

Implements hook_node_presave().

File

modules/node/tests/node_test.module, line 128

Code

function node_test_node_presave($node) {
    if ($node->title == 'testing_node_presave') {
        // Sun, 19 Nov 1978 05:00:00 GMT
        $node->created = 280299600;
        // Drupal 1.0 release.
        $node->changed = 979534800;
    }
    // Determine changes.
    if (!empty($node->original) && $node->original->title == 'test_changes') {
        if ($node->original->title != $node->title) {
            $node->title .= '_presave';
        }
    }
}

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