class RevisionLinkRevert

Same name and namespace in other branches
  1. 11.x core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php \Drupal\node\Plugin\views\field\RevisionLinkRevert

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

Plugin annotation

@ViewsField("node_revision_link_revert");

Hierarchy

Expanded class hierarchy of RevisionLinkRevert

Related topics

File

core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php, line 15

Namespace

Drupal\node\Plugin\views\field
View source
class RevisionLinkRevert extends RevisionLink {
  
  /**
   * {@inheritdoc}
   */
  protected function getUrlInfo(ResultRow $row) {
    /** @var \Drupal\node\NodeInterface $node */
    $node = $this->getEntity($row);
    return Url::fromRoute('node.revision_revert_confirm', [
      'node' => $node->id(),
      'node_revision' => $node->getRevisionId(),
    ]);
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getDefaultLabel() {
    return $this->t('Revert');
  }

}

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