function shurly_handler_field_shurly_link_edit::render in ShURLy 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- views/
shurly_handler_field_shurly_link_edit.inc, line 39 - Shurly Views handler for editing links function
Class
- shurly_handler_field_shurly_link_edit
- Field handler to present a link to the short URL entry.
Code
function render($values) {
global $user;
$uid = $values->{$this->aliases['uid']};
$active = $values->{$this->aliases['active']};
if (!$active) {
return t('deactivated');
}
// only allow the user to view the link if they can actually edit
if (user_access('Administer short URLs') || user_access('Edit own URLs') && $uid == $user->uid) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
$rid = $values->rid;
return l($text, "shurly/edit/{$rid}", array(
'query' => drupal_get_destination(),
));
}
}