1.20.x node.module node_save(Node $node)

Saves a new or updated node.

Parameters

Node $node: The $node entity to be saved. If $node->nid is omitted (or $node->is_new is TRUE), a new node will be added.

Return value

int: Either SAVED_NEW or SAVED_UPDATED depending on the operation performed.

File

modules/node/node.module, line 1047
The core module that allows content to be submitted to the site.

Code

function node_save(Node $node) {
  return $node->save();
}