You are here

function LinkEdit::render_link in Views (for Drupal 7) 8.3

Same name in this branch
  1. 8.3 lib/Views/node/Plugin/views/field/LinkEdit.php \Views\node\Plugin\views\field\LinkEdit::render_link()
  2. 8.3 lib/Views/user/Plugin/views/field/LinkEdit.php \Views\user\Plugin\views\field\LinkEdit::render_link()
  3. 8.3 lib/Views/locale/Plugin/views/field/LinkEdit.php \Views\locale\Plugin\views\field\LinkEdit::render_link()
  4. 8.3 lib/Views/comment/Plugin/views/field/LinkEdit.php \Views\comment\Plugin\views\field\LinkEdit::render_link()

Overrides Link::render_link

File

lib/Views/user/Plugin/views/field/LinkEdit.php, line 24
Definition of Views\user\Plugin\views\field\LinkEdit.

Class

LinkEdit
Field handler to present a link to user edit.

Namespace

Views\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;
  }
}