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()

Overrides Link::render_link

File

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

Class

LinkEdit
Field handler to present a link to user edit.

Namespace

Drupal\user\Plugin\views\field

Code

function render_link($data, $values) {

  // Build a pseudo account object to be able to check the access.
  $account = entity_create('user', array());
  $account->uid = $data;
  if ($data && user_edit_access($account)) {
    $this->options['alter']['make_link'] = TRUE;
    $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
    $this->options['alter']['path'] = "user/{$data}/edit";
    $this->options['alter']['query'] = drupal_get_destination();
    return $text;
  }
}