function LinkBase::renderLink

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::renderLink()
  2. 8.9.x core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::renderLink()
  3. 10 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::renderLink()

Prepares the link to view an entity.

Parameters

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

Return value

string Returns a string for the link text.

2 calls to LinkBase::renderLink()
LinkApprove::renderLink in core/modules/comment/src/Plugin/views/field/LinkApprove.php
Prepares the link to view an entity.
LinkBase::render in core/modules/views/src/Plugin/views/field/LinkBase.php
Renders the field.
4 methods override LinkBase::renderLink()
ContactLink::renderLink in core/modules/contact/src/Plugin/views/field/ContactLink.php
Prepares the link to view an entity.
EntityLink::renderLink in core/modules/views/src/Plugin/views/field/EntityLink.php
Prepares the link to view an entity.
LinkApprove::renderLink in core/modules/comment/src/Plugin/views/field/LinkApprove.php
Prepares the link to view an entity.
RevisionLink::renderLink in core/modules/node/src/Plugin/views/field/RevisionLink.php
Prepares the link to view an entity.

File

core/modules/views/src/Plugin/views/field/LinkBase.php, line 210

Class

LinkBase
Field handler to present a link to an entity.

Namespace

Drupal\views\Plugin\views\field

Code

protected function renderLink(ResultRow $row) {
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['url'] = $this->getUrlInfo($row);
    $text = !empty($this->options['text']) ? $this->sanitizeValue($this->options['text']) : $this->getDefaultLabel();
    $this->addLangcode($row);
    return $text;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.