Project

General

Profile

Paste
Download (803 Bytes) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / views / modules / user / views_handler_field_user_link_edit.inc @ 8be7bf84

1
<?php
2

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

    
8
/**
9
 * Field handler to present a link to user edit.
10
 *
11
 * @ingroup views_field_handlers
12
 */
13
class views_handler_field_user_link_edit extends views_handler_field_user_link {
14

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function render_link($data, $values) {
19
    // Build a pseudo account object to be able to check the access.
20
    $account = new stdClass();
21
    $account->uid = $data;
22

    
23
    if ($data && user_edit_access($account)) {
24
      $this->options['alter']['make_link'] = TRUE;
25

    
26
      $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
27

    
28
      $this->options['alter']['path'] = "user/$data/edit";
29
      $this->options['alter']['query'] = drupal_get_destination();
30

    
31
      return $text;
32
    }
33
  }
34

    
35
}