You are here

public function DiffEntityComparison::getRevisionDescription in Diff 8

Gets the revision description of the revision.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $revision: The current revision.

\Drupal\Core\Entity\ContentEntityInterface $previous_revision: (optional) The previous revision. Defaults to NULL.

Return value

string The revision log message.

File

src/DiffEntityComparison.php, line 267

Class

DiffEntityComparison
Entity comparison service that prepares a diff of a pair of entities.

Namespace

Drupal\diff

Code

public function getRevisionDescription(ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL) {
  $revision_summary = '';

  // Check if the revision has a revision log message.
  if ($revision instanceof RevisionLogInterface) {
    $revision_summary = Xss::filter($revision
      ->getRevisionLogMessage());
  }

  // @todo Autogenerate summary again.
  // @see https://www.drupal.org/project/diff/issues/2880936
  // Add workflow/content moderation state information.
  if ($state = $this
    ->getModerationState($revision)) {
    $revision_summary .= " ({$state})";
  }
  return $revision_summary;
}