]> Raphaƫl G. Git Repositories - blogbundle/blobdiff - Controller/AbstractController.php
Fix pre to break word on overflow
[blogbundle] / Controller / AbstractController.php
index 425cdcccaa7d5be66a81dab19abbccdb5eaee477..10353cbf421db5281fb3189231f89e4745624b03 100644 (file)
@@ -55,6 +55,11 @@ abstract class AbstractController extends BaseAbstractController implements Serv
         */
        protected array $config;
 
         */
        protected array $config;
 
+       /**
+        * Count integer
+        */
+       protected int $count;
+
        /**
         * Context array
         */
        /**
         * Context array
         */
@@ -76,7 +81,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
        protected \DateTime $modified;
 
        /**
        protected \DateTime $modified;
 
        /**
-        * Limit integer
+        * Page integer
         */
        protected int $page;
 
         */
        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
                //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