Skip to content
LinkEdit.php 840 B
Newer Older
 * Definition of Drupal\user\Plugin\views\field\LinkEdit.
use Drupal\Core\Entity\EntityInterface;
/**
 * Field handler to present a link to user edit.
 *
 * @ingroup views_field_handlers
 */
class LinkEdit extends Link {
  protected function renderLink(EntityInterface $entity, ResultRow $values) {
      $this->options['alter']['make_link'] = TRUE;

      $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit');
      $uri = $entity->uri();
      $this->options['alter']['path'] = $uri['path'] . '/edit';
      $this->options['alter']['query'] = drupal_get_destination();

      return $text;
    }
  }