5 * Definition of views_handler_field_user_link_cancel.
9 * Field handler to present a link to user cancel.
11 * @ingroup views_field_handlers
13 class views_handler_field_user_link_cancel extends views_handler_field_user_link {
15 function render_link($data, $values) {
16 $uid = $values->{$this->aliases['uid']};
18 // Build a pseudo account object to be able to check the access.
19 $account = new stdClass();
22 if ($uid && user_cancel_access($account)) {
23 $this->options['alter']['make_link'] = TRUE;
25 $text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account');
27 $this->options['alter']['path'] = "user/$uid/cancel";
28 $this->options['alter']['query'] = drupal_get_destination();