$languages =
$node->
getTranslationLanguages();
$has_translations =
(count($languages) > 1
);
$node_storage =
$this->
entityTypeManager()->
getStorage('node'
);
$build['#title'
] =
$has_translations ?
$this->
t('@langname revisions for %title',
['@langname' =>
$langname, '%title' =>
$node->
label()]) :
$this->
t('Revisions for %title',
['%title' =>
$node->
label()]);
$header =
[$this->
t('Revision'
),
$this->
t('Operations'
)];
$rows =
[];
$default_revision =
$node->
getRevisionId();
$current_revision_displayed = FALSE;
foreach ($this->
getRevisionIds($node,
$node_storage) as $vid) { /** @var \Drupal\node\NodeInterface $revision */
$revision =
$node_storage->
loadRevision($vid);
// Only show revisions that are affected by the language that is being
// displayed.
if ($revision->
hasTranslation($langcode) &&
$revision->
getTranslation($langcode)->
isRevisionTranslationAffected()) { $username =
[ '#theme' => 'username',
'#account' =>
$revision->
getRevisionUser(),
];
// Use revision link to link to revisions that are not active.