You are here

public function jcarouselPager::postExecute in jCarousel 8.5

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/pager/jcarouselPager.php \Drupal\jcarousel\Plugin\views\pager\jcarouselPager::postExecute()

Perform any needed actions just after the query executing.

Overrides PagerPluginBase::postExecute

File

src/Plugin/views/pager/jcarouselPager.php, line 62
Contains \Drupal\views\Plugin\views\pager\jcarouselPager.

Class

jcarouselPager
The plugin to handle full pager.

Namespace

Drupal\jcarousel\Plugin\views\pager

Code

public function postExecute(&$result) {

  // In query() one more item might have been retrieved than necessary. If so,
  // the next link needs to be displayed and the item removed.
  if ($this
    ->getItemsPerPage() > 0 && count($result) > $this
    ->getItemsPerPage()) {
    array_pop($result);

    // Make sure the pager shows the next link by setting the total items to
    // the biggest possible number but prevent failing calculations like
    // ceil(PHP_INT_MAX) we take PHP_INT_MAX / 2.
    $total = PHP_INT_MAX / 2;
  }
  else {
    $total = $this
      ->getCurrentPage() * $this
      ->getItemsPerPage() + count($result);
  }
  $this->total_items = $total;
}