custom/plugins/AppflixCustomerMarket/src/Storefront/Controller/AppflixAdController.php line 39

  1. <?php declare(strict_types=1);
  2. namespace Appflix\CustomerMarket\Storefront\Controller;
  3. use Appflix\CustomerMarket\Storefront\Page\AppflixAd\AppflixAdPageLoader;
  4. use Shopware\Core\Content\Seo\SeoUrlPlaceholderHandlerInterface;
  5. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  6. use Shopware\Core\System\SystemConfig\SystemConfigService;
  7. use Shopware\Storefront\Controller\StorefrontController;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. #[Route(defaults: ['_routeScope' => ['storefront']])]
  12. class AppflixAdController extends StorefrontController
  13. {
  14.     public function __construct(
  15.         private readonly AppflixAdPageLoader $appflixAdPageLoader,
  16.         private readonly SeoUrlPlaceholderHandlerInterface $seoUrlPlaceholderHandler,
  17.         private readonly SystemConfigService $systemConfigService
  18.     )
  19.     {
  20.     }
  21.     #[Route(path'/appflix-ad/{appflixAdId}'name'frontend.appflix-ad.detail.page'methods: ['GET'])]
  22.     public function index(SalesChannelContext $contextRequest $request): Response
  23.     {
  24.         $page $this->appflixAdPageLoader->load($request$context);
  25.         // Fallback layout for non-assigned product layout
  26.         if (!$page->getCmsPage()) {
  27.             return $this->renderStorefront('@Storefront/appflix-customer-market/page/appflix-ad-detail/index.html.twig', [
  28.                 'page' => $page
  29.             ]);
  30.         }
  31.         return $this->renderStorefront('@Storefront/storefront/page/content/appflix-ad-detail.html.twig', [
  32.             'page' => $page
  33.         ]);
  34.     }
  35. }