src/Controller/ContentController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Model\Product;
  4. use App\Model\ProductCategory;
  5. use App\Providers\AreaBricks\BrickGroupsProvider;
  6. // BELOW IS REQUIRED AS THE PHPDOC ABOVE THE ACTIONS USES @TEMPLATE
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Twig\Markup;
  10. class ContentController extends DefaultFrontendController
  11. {
  12.     /**
  13.      * @Template
  14.      *
  15.      * Has AreaBlock
  16.      */
  17.     public function defaultAction(Request $request)
  18.     {
  19.         return $this->data($request, [
  20.             'areaBlockSettings' => BrickGroupsProvider::defaultSettings()
  21.         ]);
  22.     }
  23.     /**
  24.      * @Template
  25.      *
  26.      * Has AreaBlock
  27.      */
  28.     public function superPageAction(Request $request)
  29.     {
  30.         // Load Category
  31.         $relatedCategoryObjectId $this->getDocumentEditable('relation''productCategory')->getData()['id'] ?? false;
  32.         $relatedCategoryObject $relatedCategoryObjectId ProductCategory::getById($relatedCategoryObjectId) : false;
  33.         $relatedCategoryProperties $relatedCategoryObject ? ($relatedCategoryObject->formatPropertyItems() ?? false) : false;
  34.         $relatedProductObjectId $this->getDocumentEditable('relation''product')->getData()['id'] ?? false;
  35.         $relatedProductObject $relatedProductObjectId Product::getById($relatedProductObjectId) : false;
  36.         return $this->data($request, [
  37.             'areaBlockSettings' => BrickGroupsProvider::defaultSettings(),
  38.             'productCategory' => $relatedCategoryObject ?? false,
  39.             'productCategoryProperties' => $relatedCategoryProperties,
  40.             'product' => $relatedProductObject,
  41.         ]);
  42.     }
  43.     /**
  44.      * @Template
  45.      *
  46.      * Has AreaBlock
  47.      */
  48.     public function homeAction(Request $request)
  49.     {
  50.         return $this->data($request, [
  51.             'areaBlockSettings' => BrickGroupsProvider::defaultSettings()
  52.         ]);
  53.     }
  54.     /**
  55.      * @Template
  56.      *
  57.      * Has AreaBlock
  58.      */
  59.     public function contactAction(Request $request)
  60.     {
  61.         return $this->data($request, [
  62.             'areaBlockSettings' => BrickGroupsProvider::defaultSettings()
  63.         ]);
  64.     }
  65.     /**
  66.      * @Template
  67.      *
  68.      * Has AreaBlock
  69.      */
  70.     public function thanksAction(Request $request)
  71.     {
  72.         $first_name $request->get('first_name');
  73.         return $this->data($request, [
  74.             'first_name' => $first_name ?? null,
  75.             'areaBlockSettings' => BrickGroupsProvider::defaultSettings()
  76.         ]);
  77.     }
  78. }