vendor/shopware/storefront/Controller/LandingPageController.php line 29

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront\Controller;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  5. use Shopware\Storefront\Page\LandingPage\LandingPageLoadedHook;
  6. use Shopware\Storefront\Page\LandingPage\LandingPageLoader;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. /**
  11.  * @internal
  12.  * Do not use direct or indirect repository calls in a controller. Always use a store-api route to get or put data
  13.  */
  14. #[Route(defaults: ['_routeScope' => ['storefront']])]
  15. #[Package('content')]
  16. class LandingPageController extends StorefrontController
  17. {
  18.     /**
  19.      * @internal
  20.      */
  21.     public function __construct(private readonly LandingPageLoader $landingPageLoader)
  22.     {
  23.     }
  24.     #[Route(path'/landingPage/{landingPageId}'name'frontend.landing.page'defaults: ['_httpCache' => true], methods: ['GET'])]
  25.     public function index(SalesChannelContext $contextRequest $request): Response
  26.     {
  27.         $page $this->landingPageLoader->load($request$context);
  28.         $this->hook(new LandingPageLoadedHook($page$context));
  29.         return $this->renderStorefront('@Storefront/storefront/page/content/index.html.twig', ['page' => $page]);
  30.     }
  31. }