You are here

protected function AuthmapDeleteLink::renderLink in SAML Authentication 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/field/AuthmapDeleteLink.php \Drupal\samlauth\Plugin\views\field\AuthmapDeleteLink::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.

Overrides LinkBase::renderLink

1 call to AuthmapDeleteLink::renderLink()
AuthmapDeleteLink::render in src/Plugin/views/field/AuthmapDeleteLink.php
Renders the field.

File

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

Class

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

Namespace

Drupal\samlauth\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. (If this needs
  // 'alter']['language' set sometimes, then we still need to work out when
  // and how.)
  $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;
}