Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / node / src / Plugin / views / field / RevisionLinkRevert.php
1 <?php
2
3 namespace Drupal\node\Plugin\views\field;
4
5 use Drupal\Core\Url;
6 use Drupal\views\ResultRow;
7
8 /**
9  * Field handler to present a link to revert a node to a revision.
10  *
11  * @ingroup views_field_handlers
12  *
13  * @ViewsField("node_revision_link_revert")
14  */
15 class RevisionLinkRevert extends RevisionLink {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function getUrlInfo(ResultRow $row) {
21     /** @var \Drupal\node\NodeInterface $node */
22     $node = $this->getEntity($row);
23     return Url::fromRoute('node.revision_revert_confirm', ['node' => $node->id(), 'node_revision' => $node->getRevisionId()]);
24   }
25
26   /**
27    * {@inheritdoc}
28    */
29   protected function getDefaultLabel() {
30     return $this->t('Revert');
31   }
32
33 }