views_handler_field_user_language.inc

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

Definition of views_handler_field_user_language.

File

modules/user/views_handler_field_user_language.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_user_language.
  5. */
  6. /**
  7. * Views field handler for user language.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_user_language extends views_handler_field_user {
  12. function render_link($data, $values) {
  13. $uid = $this->get_value($values, 'uid');
  14. if (!empty($this->options['link_to_user'])) {
  15. $uid = $this->get_value($values, 'uid');
  16. if (user_access('access user profiles') && $uid) {
  17. $this->options['alter']['make_link'] = TRUE;
  18. $this->options['alter']['path'] = 'user/' . $uid;
  19. }
  20. }
  21. if (empty($data)) {
  22. $lang = language_default();
  23. }
  24. else {
  25. $lang = language_list();
  26. $lang = $lang[$data];
  27. }
  28. return $this->sanitize_value($lang->name);
  29. }
  30. function render($values) {
  31. $value = $this->get_value($values);
  32. return $this->render_link($this->sanitize_value($value), $values);
  33. }
  34. }