function views_handler_field_user_name::render_link in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 modules/user/views_handler_field_user_name.inc \views_handler_field_user_name::render_link()
- 7.3 modules/user/views_handler_field_user_name.inc \views_handler_field_user_name::render_link()
Overrides views_handler_field_user::render_link
File
- modules/
user/ views_handler_field_user_name.inc, line 45
Class
- views_handler_field_user_name
- Field handler to provide simple renderer that allows using a themed user link
Code
function render_link($data, $values) {
if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
$account = new stdClass();
$account->uid = $values->{$this->aliases['uid']};
if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
// This is an anonymous user, and we're overriting the text.
return check_plain($this->options['anonymous_text']);
}
elseif (!empty($this->options['link_to_user'])) {
$account->name = $values->{$this->field_alias};
return theme('username', $account);
}
}
// Otherwise, there's no special handling, so return the data directly.
return $data;
}