vendor/kobizo/core-bundle/src/Controller/FeDefaultController.php line 16

Open in your IDE?
  1. <?php
  2. namespace Kobizo\Bundle\CoreBundle\Controller;
  3. use Kobizo\Bundle\CmsBundle\Controller\Page\GetPageTranslationHelper;
  4. use Kobizo\Component\Attributes\SlugAttribute;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class FeDefaultController extends KobizoFeAbstractController
  9. {
  10.     /**
  11.      * @Route("/", name="home", methods={"GET"})
  12.      */
  13.     public function index(
  14.         Request $request,
  15.         GetPageTranslationHelper $getPageTranslationHelper
  16.     ): Response {
  17.         $locale $request->getLocale();
  18.         $pageTranslation $getPageTranslationHelper->getByLocaleAndSlug($localeSlugAttribute::DEFAULT_HOMEPAGE_SLUG);
  19.         $page $pageTranslation $pageTranslation->getPage() : null;
  20.         return $this->render('@KobizoCore/frontend/index.twig', [
  21.             'locale' => $request->getLocale(),
  22.             'page' => $page,
  23.             'translation' => $pageTranslation,
  24.             'title' => $pageTranslation $pageTranslation->getTitle() : null,
  25.             'content' => $pageTranslation $pageTranslation->getContent() : null,
  26.             'tags' => $page $page->getTags() : [],
  27.             'author' => $page $page->getAuthor() : null,
  28.             'authorName' => $page $page->getAuthor()->getDisplayName() : null,
  29.             'comments' => $page $page->getComments() : [],
  30.         ]);
  31.     }
  32. }