function RevisionLink::getUrlInfo

Same name and namespace in other branches
  1. 11.x core/modules/node/src/Plugin/views/field/RevisionLink.php \Drupal\node\Plugin\views\field\RevisionLink::getUrlInfo()

File

core/modules/node/src/Plugin/views/field/RevisionLink.php, line 21

Class

RevisionLink
Field handler to present a link to a node revision.

Namespace

Drupal\node\Plugin\views\field

Code

protected function getUrlInfo(ResultRow $row) {
  /** @var \Drupal\node\NodeInterface $node */
  $node = $this->getEntity($row);
  // Current revision uses the node view path.
  return !$node->isDefaultRevision() ? Url::fromRoute('entity.node.revision', [
    'node' => $node->id(),
    'node_revision' => $node->getRevisionId(),
  ]) : $node->toUrl();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.