You are here

function views_handler_field_comment_link_edit::render_link in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 7.3 modules/comment/views_handler_field_comment_link_edit.inc \views_handler_field_comment_link_edit::render_link()

Overrides views_handler_field_comment_link::render_link

File

modules/comment/views_handler_field_comment_link_edit.inc, line 31

Class

views_handler_field_comment_link_edit
Field handler to present a link node edit.

Code

function render_link($data, $values) {
  parent::render_link($data, $values);

  // ensure user has access to edit this comment.
  $comment = new stdClass();
  $comment->cid = $this
    ->get_value($values, 'cid');
  $comment->uid = $this
    ->get_value($values, 'uid');
  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/edit/" . $comment->cid;
  return $text;
}