LinkDelete.php in File Entity (fieldable files) 8.2
File
src/Plugin/views/field/LinkDelete.php
View source
<?php
namespace Drupal\file_entity\Plugin\views\field;
use Drupal\views\ResultRow;
use Drupal\Core\Routing\RedirectDestinationTrait;
class LinkDelete extends Link {
use RedirectDestinationTrait;
protected function renderLink($file, ResultRow $values) {
$text = NULL;
if ($file
->access('delete')) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'file/' . $file
->id() . '/delete';
$this->options['alter']['query'] = $this
->getDestinationArray();
$text = !empty($this->options['text']) ? $this->options['text'] : t('Delete');
}
return $text;
}
}
Classes
Name |
Description |
LinkDelete |
Field handler to present a link to delete the file. |