You are here

protected function ContactLink::renderLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/contact/src/Plugin/views/field/ContactLink.php \Drupal\contact\Plugin\views\field\ContactLink::renderLink()

Prepares the link to view a entity.

Parameters

\Drupal\views\ResultRow $row: A view result row.

Return value

string Returns a string for the link text.

Overrides LinkBase::renderLink

File

core/modules/contact/src/Plugin/views/field/ContactLink.php, line 44
Contains \Drupal\contact\Plugin\views\field\ContactLink.

Class

ContactLink
Defines a field that links to the user contact page, if access is permitted.

Namespace

Drupal\contact\Plugin\views\field

Code

protected function renderLink(ResultRow $row) {
  $entity = $this
    ->getEntity($row);
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['url'] = $this
    ->getUrlInfo($row);
  $title = $this
    ->t('Contact %user', array(
    '%user' => $entity
      ->label(),
  ));
  $this->options['alter']['attributes'] = array(
    'title' => $title,
  );
  if (!empty($this->options['text'])) {
    return $this->options['text'];
  }
  else {
    return $title;
  }
}