From a252e1dfb6a9fe06d197eddea1d41ad0793f1f41 Mon Sep 17 00:00:00 2001 From: Sam Partington Date: Thu, 30 Nov 2017 11:33:30 +0000 Subject: [PATCH] Revert "improve omitFirstPage" This reverts commit dfe64b79846f29cc5becd034c5d2942e32e141e5. Fixes https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle/issues/158 --- Twig/PagerfantaExtension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Twig/PagerfantaExtension.php b/Twig/PagerfantaExtension.php index a1c56f4..7eb3120 100644 --- a/Twig/PagerfantaExtension.php +++ b/Twig/PagerfantaExtension.php @@ -140,8 +140,9 @@ private function createRouteGenerator($options = array()) return function($page) use($router, $routeName, $routeParams, $pagePropertyPath, $omitFirstPage) { $propertyAccessor = PropertyAccess::createPropertyAccessor(); - // don't set the page parameter if it is the first page and the omitFirstPage flag is true - if(!$omitFirstPage || $page > 1 ){ + if($omitFirstPage){ + $propertyAccessor->setValue($routeParams, $pagePropertyPath, $page > 1 ? $page : null); + } else { $propertyAccessor->setValue($routeParams, $pagePropertyPath, $page); }