public function ResourceNode::entityPreSave in RESTful 7.2
Overrides ResourceEntity::entityPreSave().
Set the node author and other defaults.
File
- src/
Plugin/ resource/ ResourceNode.php, line 18 - Contains Drupal\restful\Plugin\resource\ResourceNode.
Class
Namespace
Drupal\restful\Plugin\resourceCode
public function entityPreSave(\EntityMetadataWrapper $wrapper) {
$node = $wrapper
->value();
if (!empty($node->nid)) {
// Node is already saved.
return;
}
node_object_prepare($node);
$node->uid = $this
->getAccount()->uid;
}