You are here

protected function RevisionOverviewForm::buildRevision in Diff 8

Set and return configuration for revision.

Parameters

\Drupal\Core\Link $link: Link attribute.

string $username: Username attribute.

\Drupal\Core\Entity\ContentEntityInterface $revision: Revision parameter for getRevisionDescription function.

\Drupal\Core\Entity\ContentEntityInterface $previous_revision: (optional) Previous revision for getRevisionDescription function. Defaults to NULL.

Return value

array Configuration for revision.

1 call to RevisionOverviewForm::buildRevision()
RevisionOverviewForm::buildForm in src/Form/RevisionOverviewForm.php
Form constructor.

File

src/Form/RevisionOverviewForm.php, line 351

Class

RevisionOverviewForm
Provides a form for revision overview page.

Namespace

Drupal\diff\Form

Code

protected function buildRevision(Link $link, $username, ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL) {
  return [
    '#type' => 'inline_template',
    '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
    '#context' => [
      'date' => $link
        ->toString(),
      'username' => $this->renderer
        ->renderPlain($username),
      'message' => [
        '#markup' => $this->entityComparison
          ->getRevisionDescription($revision, $previous_revision),
        '#allowed_tags' => Xss::getAdminTagList(),
      ],
    ],
  ];
}