function LinkEdit::render_link

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

Renders the link.

Overrides Link::render_link

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/LinkEdit.php, line 28
Definition of views_handler_field_node_link_edit.

Class

LinkEdit
Field handler to present a link node edit.

Namespace

Drupal\node\Plugin\views\field

Code

function render_link($node, $values) {

  // Ensure user has access to edit this node.
  if (!node_access('update', $node)) {
    return;
  }
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = "node/{$node->nid}/edit";
  $this->options['alter']['query'] = drupal_get_destination();
  $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  return $text;
}