1.20.x node.entity.inc protected NodeStorageController::preSave(EntityInterface $node)

Overrides EntityDatabaseStorageController::preSave().

Parameters

Node $node: The node object about to be saved.

Overrides EntityDatabaseStorageController::preSave

File

modules/node/node.entity.inc, line 646
Entity controller and class for nodes.

Class

NodeStorageController
Controller class for nodes.

Code

protected function preSave(EntityInterface $node) {
  // Before saving the node, set changed and revision times.
  $node->changed = REQUEST_TIME;

  if ($this->revisionKey && !empty($node->revision)) {
    $node->revision_timestamp = REQUEST_TIME;

    if (!isset($node->revision_uid)) {
      $node->revision_uid = $GLOBALS['user']->uid;
    }
  }
}