Task #93340

Add method getPages to SimplePagination

Added by Georg Ringer 6 months ago. Updated 5 months 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()),
            ]
        );
    }

#1

Updated by Gerrit Code Review 6 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67500

#2

Updated by Gerrit Code Review 6 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67500

#3

Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67482

#4

Updated by Georg Ringer 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#5

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF