diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-14 15:03:22 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-08-23 07:24:42 +0200 |
commit | 891456ba9a592a200d8b23029e8f4514d9803080 (patch) | |
tree | 99b91dd57ab3db4a4a621cfd7c84ec7fab1d30ae /src/Wallabag/CoreBundle/Helper | |
parent | 79efca1e6ff28362d4bd2713f68205294cdd07de (diff) | |
download | wallabag-891456ba9a592a200d8b23029e8f4514d9803080.tar.gz wallabag-891456ba9a592a200d8b23029e8f4514d9803080.tar.zst wallabag-891456ba9a592a200d8b23029e8f4514d9803080.zip |
Links on each tag in Tags view
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php new file mode 100644 index 00000000..f9066bee --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | |||
@@ -0,0 +1,34 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | use Pagerfanta\Adapter\AdapterInterface; | ||
6 | use Pagerfanta\Pagerfanta; | ||
7 | use Symfony\Component\Routing\Router; | ||
8 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | ||
9 | |||
10 | class PreparePagerForEntries | ||
11 | { | ||
12 | private $user; | ||
13 | private $router; | ||
14 | |||
15 | public function __construct(TokenStorage $token, Router $router) | ||
16 | { | ||
17 | $this->user = $token->getToken()->getUser(); | ||
18 | $this->router = $router; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * @param AdapterInterface $adapter | ||
23 | * @param int $page | ||
24 | * | ||
25 | * @return null|Pagerfanta | ||
26 | */ | ||
27 | public function prepare(AdapterInterface $adapter, $page = 1) | ||
28 | { | ||
29 | $entries = new Pagerfanta($adapter); | ||
30 | $entries->setMaxPerPage($this->user->getConfig()->getItemsPerPage()); | ||
31 | |||
32 | return $entries; | ||
33 | } | ||
34 | } | ||