public function ShowMore::query in Views Show More 8
Query overwrite.
Overrides SqlBase::query
File
- src/
Plugin/ views/ pager/ ShowMore.php, line 273
Class
- ShowMore
- The plugin to handle show more pager.
Namespace
Drupal\views_show_more\Plugin\views\pagerCode
public function query() {
parent::query();
$others_page = $this->options['items_per_page'];
$limit = !empty($this->options['initial']) ? $this->options['initial'] : $others_page;
$offset = !empty($this->options['offset']) ? $this->options['offset'] : 0;
if ($this->current_page != 0) {
$offset = $limit + ($this->current_page - 1) * $others_page + $offset;
$limit = $others_page;
}
$this->view->query
->setLimit($limit);
$this->view->query
->setOffset($offset);
}