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