Overrides Link::render_link
function render_link($data, $values) {
parent::render_link($data, $values);
// ensure user has access to edit this comment.
$comment = $this
->get_value($values);
if (!comment_access('edit', $comment)) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
unset($this->options['alter']['fragment']);
if (!empty($this->options['destination'])) {
$this->options['alter']['query'] = drupal_get_destination();
}
$this->options['alter']['path'] = "comment/" . $comment
->id() . "/edit";
return $text;
}