<?php
namespace FoxHabbit\BasisBundle\Controller;
use Pimcore\Controller\FrontendController;
use FoxHabbit\BasisBundle\Manager\ConfigManager;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class SnippetController extends FrontendController
{
public function indexAction(Request $request)
{
return new Response('Hello world');
}
public function snippetSectionAction(Request $request, ConfigManager $configManager)
{
$params = [];
if( PHP_MAJOR_VERSION < 8) {
// for Pimcore < 10
$params = $this->view->getAllParameters();
}
$params['config'] = $configManager->getAreaConfig('snippet_section');
if( ! $this->document->getTemplate()) {
return $this->render('@FoxHabbitBasis/Templates/snippet-section.html.twig', $params);
}
}
public function snippetPartAction(Request $request, ConfigManager $configManager)
{
$params = [];
if( PHP_MAJOR_VERSION < 8) {
// for Pimcore < 10
$params = $this->view->getAllParameters();
}
$params['sectionConfig'] = $configManager->getAreaConfig( 'basisbundle_section');
if( ! $this->document->getTemplate()) {
return $this->render('@FoxHabbitBasis/Templates/snippet-part.html.twig', $params);
}
}
public function snippetContentAction(Request $request, ConfigManager $configManager)
{
$params = [];
if( PHP_MAJOR_VERSION < 8) {
// for Pimcore < 10
$params = $this->view->getAllParameters();
}
$params['sectionConfig'] = $configManager->getAreaConfig( 'basisbundle_section');
$params['partConfig'] = $configManager->getAreaConfig( 'basisbundle_part_content');
if( ! $this->document->getTemplate()) {
return $this->render('@FoxHabbitBasis/Templates/snippet-content.html.twig', $params);
}
}
}