function ContactLink::renderLink
Same name in other branches
- 8.9.x core/modules/contact/src/Plugin/views/field/ContactLink.php \Drupal\contact\Plugin\views\field\ContactLink::renderLink()
- 10 core/modules/contact/src/Plugin/views/field/ContactLink.php \Drupal\contact\Plugin\views\field\ContactLink::renderLink()
- 11.x core/modules/contact/src/Plugin/views/field/ContactLink.php \Drupal\contact\Plugin\views\field\ContactLink::renderLink()
Overrides LinkBase::renderLink
File
-
core/
modules/ contact/ src/ Plugin/ views/ field/ ContactLink.php, line 39
Class
- ContactLink
- Defines a field that links to the user contact page, if access is permitted.
Namespace
Drupal\contact\Plugin\views\fieldCode
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', [
'%user' => $entity->label(),
]);
$this->options['alter']['attributes'] = [
'title' => $title,
];
if (!empty($this->options['text'])) {
return $this->options['text'];
}
else {
return $title;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.