Project

General

Profile

Actions

Task #93340

closed

Add method getPages to SimplePagination

Added by Georg Ringer almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2021-01-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Reduce the overhead for extension developers by returning the amount of pages directly in the SimplePagination.

current example, thanks to Susi https://susi.dev/typo3-fluid-paginate#adding-pagination-to-the-extbase-controller

    /**
     * @param int $currentPage
     */
    public function listAction(int $currentPage = 1)
    {
        $productIds = explode(',', $this->settings['items'] ?? '');
        $products = $this->productService->getProductsByIds($productIds);
        $arrayPaginator = new ArrayPaginator($products, $currentPage, 8);
        $pagination = new SimplePagination($arrayPaginator);
        $this->view->assignMultiple(
            [
                'products' => $products,
                'paginator' => $arrayPaginator,
                'pagination' => $pagination,
                'pages' => range(1, $pagination->getLastPageNumber()),
            ]
        );
    }

Actions

Also available in: Atom PDF