RevisionLinkDelete.php

Same filename and directory in other branches
  1. 9 core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php
  2. 10 core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php
  3. 11.x core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php

Namespace

Drupal\node\Plugin\views\field

File

core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php

View source
<?php

namespace Drupal\node\Plugin\views\field;

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

/**
 * Field handler to present link to delete a node revision.
 *
 * @ingroup views_field_handlers
 *
 * @ViewsField("node_revision_link_delete")
 */
class RevisionLinkDelete extends RevisionLink {
    
    /**
     * {@inheritdoc}
     */
    protected function getUrlInfo(ResultRow $row) {
        
        /** @var \Drupal\node\NodeInterface $node */
        $node = $this->getEntity($row);
        return Url::fromRoute('node.revision_delete_confirm', [
            'node' => $node->id(),
            'node_revision' => $node->getRevisionId(),
        ]);
    }
    
    /**
     * {@inheritdoc}
     */
    protected function getDefaultLabel() {
        return $this->t('Delete');
    }

}

Classes

Title Deprecated Summary
RevisionLinkDelete Field handler to present link to delete a node revision.

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