function Node::preSave
Overrides ContentEntityBase::preSave
File
- 
              core/
modules/ node/ src/ Entity/ Node.php, line 102  
Class
- Node
 - Defines the node entity class.
 
Namespace
Drupal\node\EntityCode
public function preSave(EntityStorageInterface $storage) {
  parent::preSave($storage);
  foreach (array_keys($this->getTranslationLanguages()) as $langcode) {
    $translation = $this->getTranslation($langcode);
    // If no owner has been set explicitly, make the anonymous user the owner.
    if (!$translation->getOwner()) {
      $translation->setOwnerId(0);
    }
  }
  // If no revision author has been set explicitly, make the node owner the
  // revision author.
  if (!$this->getRevisionUser()) {
    $this->setRevisionUserId($this->getOwnerId());
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.