You are here

protected function Link::renderLink in Profile 2 8

Prepares the link to the node.

Parameters

\Drupal\Core\Entity\EntityInterface $node: The node entity this field belongs to.

ResultRow $values: The values retrieved from the view's result set.

Return value

string Returns a string for the link text.

1 call to Link::renderLink()
Link::render in src/Plugin/views/field/Link.php
Renders the field.
2 methods override Link::renderLink()
LinkDelete::renderLink in src/Plugin/views/field/LinkDelete.php
Prepares the link to delete a profile.
LinkEdit::renderLink in src/Plugin/views/field/LinkEdit.php
Prepares the link to the profile.

File

src/Plugin/views/field/Link.php, line 76
Definition of Drupal\profile\Plugin\views\field\Link.

Class

Link
Field handler to present a link to the node.

Namespace

Drupal\profile\Plugin\views\field

Code

protected function renderLink($profile, ResultRow $values) {
  if ($profile
    ->access('view')) {
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = 'profile/' . $profile
      ->id();
    $text = !empty($this->options['text']) ? $this->options['text'] : t('View');
    return $text;
  }
}