You are here

public function views_handler_field_comment_link_edit::render_link in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.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 43
Definition of views_handler_field_comment_link_edit.

Class

views_handler_field_comment_link_edit
Field handler to present a link node edit.

Code

public 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->cid . "/edit";
  return $text;
}