You are here

protected function EntityPager::getLink in Entity Pager 8

Same name and namespace in other branches
  1. 2.0.x src/EntityPager.php \Drupal\entity_pager\EntityPager::getLink()

Returns an Entity pager link.

Parameters

string $name: The name of the link to return.

int $offset: The offset from the current row that this link should link to.

Return value

array The render array for the specified link.

1 call to EntityPager::getLink()
EntityPager::getLinks in src/EntityPager.php
Gets an array of entity pager link render arrays.

File

src/EntityPager.php, line 223

Class

EntityPager
Entity pager object.

Namespace

Drupal\entity_pager

Code

protected function getLink($name, $offset = 0) {
  $row = $this
    ->getResultRow($this
    ->getCurrentRow() + $offset);
  $disabled = !is_object($row);
  $entity = $disabled ? NULL : $this
    ->getResultEntity($row);
  $title = $this
    ->detokenize($this->options[$name], $entity);
  if (!$disabled || $this->options['show_disabled_links']) {
    $pager_link = new EntityPagerLink($title, $entity);
    $link = $pager_link
      ->getLink();
  }
  else {
    $link = [];
  }
  return $link;
}