Projet

Général

Profil

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

root / drupal7 / sites / all / modules / file_entity / views / views_handler_field_file_link_edit.inc @ 66c11afc

1
<?php
2

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

    
8
/**
9
 * Field handler to present a link file edit.
10
 *
11
 * @ingroup views_field_handlers
12
 */
13
class views_handler_field_file_link_edit extends views_handler_field_file_link {
14

    
15
  /**
16
   * Renders the link.
17
   */
18
  function render_link($file, $values) {
19
    // Ensure user has access to edit this file.
20
    if (!file_entity_access('update', $file)) {
21
      return;
22
    }
23

    
24
    $this->options['alter']['make_link'] = TRUE;
25
    $this->options['alter']['path'] = "file/$file->fid/edit";
26
    $this->options['alter']['query'] = drupal_get_destination();
27

    
28
    $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit');
29
    return $text;
30
  }
31
}