You are here

protected function AuthmapDeleteLink::renderLink in External Authentication 2.0.x

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.

Overrides LinkBase::renderLink

File

src/Plugin/views/field/AuthmapDeleteLink.php, line 36

Class

AuthmapDeleteLink
Field handler to present a link to delete an authmap entry.

Namespace

Drupal\externalauth\Plugin\views\field

Code

protected function renderLink(ResultRow $row) {

  // From EntityLink:
  if ($this->options['output_url_as_text']) {
    return $this
      ->getUrlInfo($row)
      ->toString();
  }

  // From LinkBase, minus addLangCode() which needs an entity.
  $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();
  return $text;
}