You are here

public function Flexbox::getLinkLocation in Views Flexbox 8

Return the token-replaced link for the specified result.

Parameters

int $result_index: The delta of the result item to get link for.

Return value

string A string url.

File

src/Plugin/views/style/Flexbox.php, line 194

Class

Flexbox
Style plugin to render each item in a flexbox layout.

Namespace

Drupal\views_flexbox\Plugin\views\style

Code

public function getLinkLocation($result_index) {
  $link = $this->options['link_source'];
  if (!empty($link) && $this
    ->usesFields() && $this->view->field) {
    $link = strip_tags($this
      ->tokenizeValue($link, $result_index));
  }
  elseif (isset($this->view->results[$result_index]) && isset($this->view->results[$result_index]->_entity)) {
    $link = $this->view->results[$result_index]->_entity
      ->toUrl();
  }
  return $link;
}