function views_handler_field_contact_link::render in Views (for Drupal 7) 6.2
Render the field.
Parameters
$values: The values retrieved from the database.
Overrides views_handler_field_user_link::render
File
- modules/
contact/ views_handler_field_contact_link.inc, line 43
Class
- views_handler_field_contact_link
- A field that links to the user contact page, if access is permitted.
Code
function render($values) {
global $user;
$uid = $values->{$this->aliases['uid']};
if (empty($uid)) {
return;
}
$account = user_load($uid);
if (empty($account)) {
return;
}
// Check access when we pull up the user account so we know
// if the user has made the contact page available.
$menu_item = menu_get_item("user/{$uid}/contact");
if (!$menu_item['access'] || empty($account->contact)) {
return;
}
if ($this->options['link_display'] == 'icon') {
return l(theme('image', 'misc/forum-new.png'), 'user/' . $account->uid . '/contact', array(
'html' => TRUE,
'attributes' => array(
'title' => t('Contact %user', array(
'%user' => $account->name,
)),
),
));
}
else {
return l($this->options['text'], 'user/' . $account->uid . '/contact', array(
'attributes' => array(
'title' => t('Contact %user', array(
'%user' => $account->name,
)),
),
));
}
}