Mercurial > hg > isophonics-drupal-site
diff core/modules/node/src/Controller/NodeController.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | c2387f117808 |
line wrap: on
line diff
--- a/core/modules/node/src/Controller/NodeController.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/modules/node/src/Controller/NodeController.php Mon Apr 23 09:46:53 2018 +0100 @@ -173,6 +173,7 @@ $rows = []; $default_revision = $node->getRevisionId(); + $current_revision_displayed = FALSE; foreach ($this->getRevisionIds($node, $node_storage) as $vid) { /** @var \Drupal\node\NodeInterface $revision */ @@ -187,11 +188,18 @@ // Use revision link to link to revisions that are not active. $date = $this->dateFormatter->format($revision->revision_timestamp->value, 'short'); - if ($vid != $node->getRevisionId()) { + + // We treat also the latest translation-affecting revision as current + // revision, if it was the default revision, as its values for the + // current language will be the same of the current default revision in + // this case. + $is_current_revision = $vid == $default_revision || (!$current_revision_displayed && $revision->wasDefaultRevision()); + if (!$is_current_revision) { $link = $this->l($date, new Url('entity.node.revision', ['node' => $node->id(), 'node_revision' => $vid])); } else { $link = $node->link($date); + $current_revision_displayed = TRUE; } $row = []; @@ -210,7 +218,7 @@ $this->renderer->addCacheableDependency($column['data'], $username); $row[] = $column; - if ($vid == $default_revision) { + if ($is_current_revision) { $row[] = [ 'data' => [ '#prefix' => '<em>',