Projet

Général

Profil

Paste
Télécharger (859 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / comment / views_handler_field_comment_link_delete.inc @ 5d12d676

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_field_comment_link_delete.
6
 */
7

    
8
/**
9
 * Field handler to present a link to delete a node.
10
 *
11
 * @ingroup views_field_handlers
12
 */
13
class views_handler_field_comment_link_delete extends views_handler_field_comment_link {
14

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function access() {
19
    // Needs permission to administer comments in general.
20
    return user_access('administer comments');
21
  }
22

    
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function render_link($data, $values) {
27
    $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
28
    $cid =  $this->get_value($values, 'cid');
29

    
30
    $this->options['alter']['make_link'] = TRUE;
31
    $this->options['alter']['path'] = "comment/" . $cid . "/delete";
32
    $this->options['alter']['query'] = drupal_get_destination();
33

    
34
    return $text;
35
  }
36

    
37
}