views_handler_field_user_picture.inc

  1. 3.x modules/user/views_handler_field_user_picture.inc
  2. 2.x modules/user/views_handler_field_user_picture.inc

File

modules/user/views_handler_field_user_picture.inc
View source
  1. <?php
  2. /**
  3. * Field handler to provide simple renderer that allows using a themed user link
  4. */
  5. class views_handler_field_user_picture extends views_handler_field {
  6. function construct() {
  7. parent::construct();
  8. $this->additional_fields['uid'] = 'uid';
  9. $this->additional_fields['name'] = 'name';
  10. $this->additional_fields['mail'] = 'mail';
  11. }
  12. function element_type() {
  13. return 'div';
  14. }
  15. function render($values) {
  16. // Fake an account object.
  17. $account = new stdClass();
  18. $account->uid = $values->{$this->aliases['uid']};
  19. $account->name = $values->{$this->aliases['name']};
  20. $account->mail = $values->{$this->aliases['mail']};
  21. $account->picture = $values->{$this->field_alias};
  22. return theme('user_picture', $account);
  23. }
  24. }