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

Views field handler for userlanguage.

File

modules/user/views_handler_field_user_language.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Views field handler for userlanguage.
  5. */
  6. class views_handler_field_user_language extends views_handler_field_user {
  7. function render_link($data, $values) {
  8. if (!empty($this->options['link_to_user']) && user_access('access user profiles') && $values->{$this->aliases['uid']}) {
  9. $this->options['alter']['make_link'] = TRUE;
  10. $this->options['alter']['path'] = 'user/' . $values->{$this->aliases['uid']};
  11. }
  12. if (empty($data)) {
  13. $lang = language_default();
  14. }
  15. else {
  16. $lang = language_list();
  17. $lang = $lang[$data];
  18. }
  19. return check_plain($lang->name);
  20. }
  21. function render($values) {
  22. return $this->render_link(check_plain($values->{$this->field_alias}), $values);
  23. }
  24. }