Neos\ContentRepository\ViewHelpers\Widget\Controller\PaginateController::indexAction PHP Method

indexAction() public method

public indexAction ( integer $currentPage = 1 ) : void
$currentPage integer
return void
    public function indexAction($currentPage = 1)
    {
        $this->currentPage = (int) $currentPage;
        if ($this->currentPage < 1) {
            $this->currentPage = 1;
        } elseif ($this->currentPage > $this->numberOfPages) {
            throw new PageNotFoundException();
        }
        $itemsPerPage = (int) $this->configuration['itemsPerPage'];
        if ($this->maximumNumberOfNodes > 0 && $this->maximumNumberOfNodes < $itemsPerPage) {
            $itemsPerPage = $this->maximumNumberOfNodes;
        }
        $offset = $this->currentPage > 1 ? (int) ($itemsPerPage * ($this->currentPage - 1)) : null;
        if ($this->parentNode === null) {
            $nodes = array_slice($this->nodes, $offset, $itemsPerPage);
        } else {
            $nodes = $this->parentNode->getChildNodes($this->nodeTypeFilter, $itemsPerPage, $offset);
        }
        $this->view->assign('contentArguments', array($this->widgetConfiguration['as'] => $nodes));
        $this->view->assign('configuration', $this->configuration);
        $this->view->assign('pagination', $this->buildPagination());
    }