X-Git-Url: https://git.rapsys.eu/blogbundle/blobdiff_plain/ece8498a290aa1ef166eaa8d8c66c38c616f3537..d9a542802b8ccf815f9d11fafc62245dab88a1eb:/Controller/AbstractController.php diff --git a/Controller/AbstractController.php b/Controller/AbstractController.php index 425cdcc..10353cb 100644 --- a/Controller/AbstractController.php +++ b/Controller/AbstractController.php @@ -55,6 +55,11 @@ abstract class AbstractController extends BaseAbstractController implements Serv */ protected array $config; + /** + * Count integer + */ + protected int $count; + /** * Context array */ @@ -76,7 +81,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv protected \DateTime $modified; /** - * Limit integer + * Page integer */ protected int $page; @@ -456,6 +461,21 @@ abstract class AbstractController extends BaseAbstractController implements Serv } } + //With count + if (!empty($this->count)) { + //With prev link + if ($this->page > 0) { + //Set head prev + $parameters['head']['prev'] = $this->generateUrl($this->request->get('_route'), ['page' => $this->page - 1]+$this->request->get('_route_params')); + } + + //With next link + if ($this->count > ($this->page + 1) * $this->limit) { + //Set head next + $parameters['head']['next'] = $this->generateUrl($this->request->get('_route'), ['page' => $this->page + 1]+$this->request->get('_route_params')); + } + } + //Without facebook image defined and texts if (empty($parameters['head']['facebook']['og:image']) && !empty($this->request) && !empty($parameters['head']['fbimage']['texts']) && !empty($this->modified)) { //Get facebook image