You are here

protected function Label::renderLink in Profile 2 8

Prepares the link to the profile.

Parameters

\Drupal\Core\Entity\EntityInterface $profile: The profile 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 Label::renderLink()
Label::render in src/Plugin/views/field/Label.php
Renders the field.

File

src/Plugin/views/field/Label.php, line 57
Definition of Drupal\profile\Plugin\views\field\Label.

Class

Label
Field handler to show the generated label of a profile.

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();
    return $profile
      ->label();
  }
}