1 views_handler_field_user_name.inc | views_handler_field_user_name::render_link($data, $values) |
Overrides views_handler_field_user::render_link
File
- core/
modules/ user/ views/ views_handler_field_user_name.inc, line 63 - Definition of views_handler_field_user_name.
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) {
$account = new stdClass();
$account->uid = $this->get_value($values, 'uid');
$account->name = $this->get_value($values);
if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
// This is an anonymous user, and we're overwriting the text.
return check_plain($this->options['anonymous_text']);
}
elseif (!empty($this->options['link_to_user'])) {
$account->name = $this->get_value($values);
return theme('username', array('account' => $account));
}
}
// If we want a formatted username, do that.
if (!empty($this->options['format_username'])) {
return user_format_name($account);
}
// Otherwise, there's no special handling, so return the data directly.
return $data;
}