function LinkEdit::render_link

Same name in this branch
  1. 8.x drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/LinkEdit.php \Drupal\node\Plugin\views\field\LinkEdit::render_link()
  2. 8.x drupal/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkEdit.php \Drupal\user\Plugin\views\field\LinkEdit::render_link()
  3. 8.x drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php \Drupal\comment\Plugin\views\field\LinkEdit::render_link()

Overrides Link::render_link

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php, line 40
Definition of Drupal\comment\Plugin\views\field\LinkEdit.

Class

LinkEdit
Field handler to present a link node edit.

Namespace

Drupal\comment\Plugin\views\field

Code

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

  // ensure user has access to edit this comment.
  $comment = $this
    ->getValue($values);
  if (!$comment
    ->access('update')) {
    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;
}