1 views_handler_field_comment_link_edit.inc views_handler_field_comment_link_edit::render_link($data, $values)

Overrides views_handler_field_comment_link::render_link

File

core/modules/comment/views/views_handler_field_comment_link_edit.inc, line 33
Definition of views_handler_field_comment_link_edit.

Class

views_handler_field_comment_link_edit
Field handler to present a link to edit a comment.

Code

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'] = backdrop_get_destination();
  }

  $this->options['alter']['path'] = "comment/" . $comment->cid . "/edit";

  return $text;
}