You are here

protected function RevisionLink::getUrlInfo in Drupal 10

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

Returns the URI elements of the link.

Parameters

\Drupal\views\ResultRow $row: A view result row.

Return value

\Drupal\Core\Url The URI elements of the link.

Overrides LinkBase::getUrlInfo

2 methods override RevisionLink::getUrlInfo()
RevisionLinkDelete::getUrlInfo in core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php
Returns the URI elements of the link.
RevisionLinkRevert::getUrlInfo in core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php
Returns the URI elements of the link.

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();
}