25 protected $configuration = [
'itemsPerPage' => 10,
'insertAbove' =>
false,
'insertBelow' =>
true,
'recordsLabel' =>
''];
62 $this->objects = $this->widgetConfiguration[
'objects'];
64 $this->numberOfObjects = count($this->objects);
76 if ($this->currentPage < 1) {
77 $this->currentPage = 1;
79 if ($this->currentPage > $this->numberOfPages) {
81 $modifiedObjects =
null;
84 $this->itemsPerPage = (int)$this->configuration[
'itemsPerPage'];
85 $query = $this->objects->getQuery();
86 $query->setLimit($this->itemsPerPage);
87 $this->offset = $this->itemsPerPage * ($this->currentPage - 1);
88 if ($this->currentPage > 1) {
89 $query->setOffset($this->offset);
91 $modifiedObjects = $query->execute();
93 $this->view->assign(
'contentArguments', [
94 $this->widgetConfiguration[
'as'] => $modifiedObjects
96 $this->view->assign(
'configuration', $this->configuration);
108 if ($endRecord > $this->numberOfObjects) {
114 'hasLessPages' => $this->currentPage > 1,
116 'startRecord' => $this->offset + 1,
117 'endRecord' => $endRecord
119 if ($this->currentPage < $this->numberOfPages) {
120 $pagination[
'nextPage'] = $this->currentPage + 1;
122 if ($this->currentPage > 1) {
123 $pagination[
'previousPage'] = $this->currentPage - 1;