Links on each tag in Tags view

This commit is contained in:
Nicolas Lœuillet
2016-04-14 15:03:22 +02:00
committed by Jeremy Benoist
parent 79efca1e6f
commit 891456ba9a
7 changed files with 88 additions and 6 deletions

View File

@ -0,0 +1,34 @@
<?php
namespace Wallabag\CoreBundle\Helper;
use Pagerfanta\Adapter\AdapterInterface;
use Pagerfanta\Pagerfanta;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
class PreparePagerForEntries
{
private $user;
private $router;
public function __construct(TokenStorage $token, Router $router)
{
$this->user = $token->getToken()->getUser();
$this->router = $router;
}
/**
* @param AdapterInterface $adapter
* @param int $page
*
* @return null|Pagerfanta
*/
public function prepare(AdapterInterface $adapter, $page = 1)
{
$entries = new Pagerfanta($adapter);
$entries->setMaxPerPage($this->user->getConfig()->getItemsPerPage());
return $entries;
}
}