New Header / Slider / Infos from API

This commit is contained in:
Kevin Adametz 2019-12-28 20:12:23 +01:00
parent 645ea5da7d
commit ee89626864
49 changed files with 6213 additions and 965 deletions

View file

@ -16,6 +16,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
*/
class ComponentController extends Controller
{
private $headerContent;
/**
* @return EntityManager
*/
@ -24,15 +26,52 @@ class ComponentController extends Controller
return $this->getDoctrine()->getManager();
}
public function getHeaderContent(){
if(!$this->headerContent){
$this->headerContent = Util::loadFromApi('cms/header/info', ['url'=>""]);
}
return $this->headerContent;
}
public function headerAction()
{
$navPages = $this->getEntityManager()->getRepository('AppBundle:Page')->findTopCountryNavPages();
$content = $this->getHeaderContent();
$local = [];
foreach ($content->local as $key=>$value){
$local[$key] = $value;
}
$phone = [];
foreach ($content->phone as $key=>$value){
$phone[$key] = $value;
}
return $this->render('default/components/header.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'nav_pages' => $navPages,
'content' => $content,
'local' => $local,
'phone' => $phone,
]);
}
public function footerAction()
{
$content = $this->getHeaderContent();
return $this->render('default/components/footer.html.twig', [
'content' => $content,
]);
}
public function breadcrumbAction(Page $page)
{
return $this->render('default/components/breadcrumb.html.twig', [