bundles/FoxHabbit/BasisBundle/Controller/SnippetController.php line 28

Open in your IDE?
  1. <?php
  2. namespace FoxHabbit\BasisBundle\Controller;
  3. use Pimcore\Controller\FrontendController;
  4. use FoxHabbit\BasisBundle\Manager\ConfigManager;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. class SnippetController extends FrontendController
  8. {
  9.     public function indexAction(Request $request)
  10.     {
  11.         return new Response('Hello world');
  12.     }
  13.     public function snippetSectionAction(Request $requestConfigManager $configManager)
  14.     {
  15.         $params = [];
  16.         if( PHP_MAJOR_VERSION 8) {
  17.             // for Pimcore < 10
  18.             $params $this->view->getAllParameters();
  19.         }
  20.         $params['config'] = $configManager->getAreaConfig('snippet_section');
  21.         if( ! $this->document->getTemplate()) {
  22.             return $this->render('@FoxHabbitBasis/Templates/snippet-section.html.twig'$params);
  23.         }
  24.     }
  25.     public function snippetPartAction(Request $requestConfigManager $configManager)
  26.     {
  27.         $params = [];
  28.         if( PHP_MAJOR_VERSION 8) {
  29.             // for Pimcore < 10
  30.             $params $this->view->getAllParameters();
  31.         }
  32.         $params['sectionConfig'] = $configManager->getAreaConfig'basisbundle_section');
  33.         if( ! $this->document->getTemplate()) {
  34.             return $this->render('@FoxHabbitBasis/Templates/snippet-part.html.twig'$params);
  35.         }
  36.     }
  37.     public function snippetContentAction(Request $requestConfigManager $configManager)
  38.     {
  39.         $params = [];
  40.         if( PHP_MAJOR_VERSION 8) {
  41.             // for Pimcore < 10
  42.             $params $this->view->getAllParameters();
  43.         }
  44.         $params['sectionConfig'] = $configManager->getAreaConfig'basisbundle_section');
  45.         $params['partConfig'] = $configManager->getAreaConfig'basisbundle_part_content');
  46.         if( ! $this->document->getTemplate()) {
  47.             return $this->render('@FoxHabbitBasis/Templates/snippet-content.html.twig'$params);
  48.         }
  49.     }
  50. }