views_handler_field_user_link_edit.inc 763 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_user_link_edit.
  5. */
  6. /**
  7. * Field handler to present a link to user edit.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_user_link_edit extends views_handler_field_user_link {
  12. function render_link($data, $values) {
  13. // Build a pseudo account object to be able to check the access.
  14. $account = new stdClass();
  15. $account->uid = $data;
  16. if ($data && user_edit_access($account)) {
  17. $this->options['alter']['make_link'] = TRUE;
  18. $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  19. $this->options['alter']['path'] = "user/$data/edit";
  20. $this->options['alter']['query'] = drupal_get_destination();
  21. return $text;
  22. }
  23. }
  24. }