src/Controller/Website/HomeController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Website;
  3. use App\Service\DocumentManagerServices;
  4. use App\Service\InstagramService;
  5. use Sulu\Bundle\WebsiteBundle\Controller\DefaultController;
  6. use Sulu\Component\Content\Compat\StructureInterface;
  7. use Symfony\Component\HttpFoundation\RequestStack;
  8. use Symfony\Component\HttpFoundation\Response;
  9. class HomeController extends DefaultController {
  10.   public function __construct(RequestStack $requestDocumentManagerServices $documentManagerServiceInstagramService $instagramService) {
  11.     $this->request $request;
  12.     $this->documentManagerService $documentManagerService;
  13.     $this->instagramService $instagramService;
  14.   }
  15.   protected function getAttributes($attributesStructureInterface $structure null$preview true) {
  16.     $attributes parent::getAttributes($attributes$structure$preview);
  17.     $locale $this->request->getMainRequest()->getLocale();
  18.     $instagram_limit = new Response($this->getParameter('INSTAGRAM_LIMIT'));
  19.     $instagram_token = new Response($this->getParameter('INSTAGRAM_API_TOKEN'));
  20.     
  21.     $medias $this->instagramService->fetchInstagramPost($instagram_limit$instagram_token);
  22.     $attributes['medias'] = $medias;
  23.     return $attributes;
  24.   }
  25. }
  26.