public function pagination(PaginationEvent $event) { $pagination = new SlidingPagination($this->engine, $this->routerHelper, $this->translator, $this->params); $pagination->setUsedRoute($this->route); $pagination->setTemplate($this->options['defaultPaginationTemplate']); $pagination->setSortableTemplate($this->options['defaultSortableTemplate']); $pagination->setPageRange($this->options['defaultPageRange']); $event->setPagination($pagination); $event->stopPropagation(); }
/** * @param array $data * @param array $items * @param string $route * * @return SlidingPagination */ public static function build(array $data, array $items, $route) { $pagination = new SlidingPagination($data['params']); $pagination->setItems($items); $pagination->setCurrentPageNumber($data['current_page_number']); $pagination->setItemNumberPerPage($data['num_items_per_page']); $pagination->setTotalItemCount($data['total_count']); $pagination->setPaginatorOptions($data['paginator_options']); $pagination->setCustomParameters($data['custom_parameters']); $pagination->setUsedRoute($route); $pagination->setPageRange($data['page_range']); $pagination->setTemplate($data['template']); $pagination->setSortableTemplate($data['sortable_template']); $pagination->setFiltrationTemplate($data['filtration_template']); return $pagination; }
public function pagination(PaginationEvent $event) { // default sort field and order $eventOptions = $event->options; if (isset($eventOptions['defaultSortFieldName']) && !isset($this->params[$eventOptions['sortFieldParameterName']])) { $this->params[$eventOptions['sortFieldParameterName']] = $eventOptions['defaultSortFieldName']; } if (isset($eventOptions['defaultSortDirection']) && !isset($this->params[$eventOptions['sortDirectionParameterName']])) { $this->params[$eventOptions['sortDirectionParameterName']] = $eventOptions['defaultSortDirection']; } $pagination = new SlidingPagination($this->params); $pagination->setUsedRoute($this->route); $pagination->setTemplate($this->options['defaultPaginationTemplate']); $pagination->setSortableTemplate($this->options['defaultSortableTemplate']); $pagination->setFiltrationTemplate($this->options['defaultFiltrationTemplate']); $pagination->setPageRange($this->options['defaultPageRange']); $event->setPagination($pagination); $event->stopPropagation(); }