src/Controller/Website/PartnersController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Website;
  3. use App\Service\DocumentManagerServices;
  4. use Sulu\Bundle\WebsiteBundle\Controller\DefaultController;
  5. use Sulu\Component\Content\Compat\StructureInterface;
  6. use Symfony\Component\HttpFoundation\RequestStack;
  7. class PartnersController extends DefaultController {
  8.   public function __construct(RequestStack $requestDocumentManagerServices $documentManagerService) {
  9.     $this->request $request;
  10.     $this->documentManagerService $documentManagerService;
  11.   }
  12.   protected function getAttributes($attributesStructureInterface $structure null$preview true) {
  13.     $attributes parent::getAttributes($attributes$structure$preview);
  14.     $locale $this->request->getMainRequest()->getLocale();
  15.     $template "singlePartner";
  16.  
  17.  
  18.     $nbrItems $this->documentManagerService->getPageListLength($locale$template);
  19.     $pages ceil($nbrItems 6);
  20.     
  21.     $attributes['nbrPages'] = $pages;
  22.     return $attributes;
  23.   }
  24. }
  25.