Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Node.php

function Node::preSaveRevision

Overrides ContentEntityBase::preSaveRevision

File

core/modules/node/src/Entity/Node.php, line 137

Class

Node
Defines the node entity class.

Namespace

Drupal\node\Entity

Code

public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
    parent::preSaveRevision($storage, $record);
    if (!$this->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {
        // If we are updating an existing node without adding a new revision, we
        // need to make sure $entity->revision_log is reset whenever it is empty.
        // Therefore, this code allows us to avoid clobbering an existing log
        // entry with an empty one.
        $record->revision_log = $this->original->revision_log->value;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal