public function LinkCancel::render_link

Overrides \Drupal\user\Plugin\views\field\Link::render_link().

Overrides Link::render_link

File

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

Class

LinkCancel
Field handler to present a link to user cancel.

Namespace

Drupal\user\Plugin\views\field

Code

public function render_link(EntityInterface $entity, \stdClass $values) {
  if ($entity && $entity
    ->access('delete')) {
    $this->options['alter']['make_link'] = TRUE;
    $text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account');
    $uri = $entity
      ->uri();
    $this->options['alter']['path'] = $uri['path'] . '/cancel';
    $this->options['alter']['query'] = drupal_get_destination();
    return $text;
  }
}