LinkDelete.php in Views (for Drupal 7) 8.3
Same filename in this branch
Definition of Views\comment\Plugin\views\field\LinkDelete.
Namespace
Views\comment\Plugin\views\fieldFile
lib/Views/comment/Plugin/views/field/LinkDelete.phpView source
<?php
/**
* @file
* Definition of Views\comment\Plugin\views\field\LinkDelete.
*/
namespace Views\comment\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to present a link to delete a node.
*
* @ingroup views_field_handlers
*
* @Plugin(
* id = "comment_link_delete",
* module = "comment"
* )
*/
class LinkDelete extends Link {
public function access() {
//needs permission to administer comments in general
return user_access('administer comments');
}
function render_link($data, $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
$cid = $this
->get_value($values, 'cid');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "comment/" . $cid . "/delete";
$this->options['alter']['query'] = drupal_get_destination();
return $text;
}
}
Classes
Name | Description |
---|---|
LinkDelete | Field handler to present a link to delete a node. |