You are here

RevisionLinkRevert.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php

File

core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php
View source
<?php

/**
 * @file
 * Contains \Drupal\node\Plugin\views\field\RevisionLinkRevert.
 */
namespace Drupal\node\Plugin\views\field;

use Drupal\Core\Url;
use Drupal\views\ResultRow;

/**
 * Field handler to present a link to revert a node to a revision.
 *
 * @ingroup views_field_handlers
 *
 * @ViewsField("node_revision_link_revert")
 */
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');
  }

}

Classes

Namesort descending Description
RevisionLinkRevert Field handler to present a link to revert a node to a revision.