app/Customize/Controller/LegalController.php line 51

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Customize\Controller;
  13. use Eccube\Controller\AbstractController;
  14. use Eccube\Repository\LayoutRepository;
  15. use Eccube\Entity\Layout;
  16. use Eccube\Repository\BaseInfoRepository;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\Routing\Annotation\Route;
  19. use Customize\Helper\PageHelper;
  20. class LegalController extends AbstractController
  21. {
  22.     /**
  23.      * @var LayoutRepository
  24.      */
  25.     protected $layoutRepository;
  26.     /**
  27.      * @var BaseInfoRepository
  28.      */
  29.     protected $baseInfoRepository;
  30.     /**
  31.      * LegalController constructor.
  32.      *
  33.      * @param LayoutRepository $layoutRepository
  34.      * @param BaseInfoRepository $baseInfoRepository
  35.      */
  36.     public function __construct(LayoutRepository $layoutRepositoryBaseInfoRepository $baseInfoRepository)
  37.     {
  38.         $this->layoutRepository $layoutRepository;
  39.         $this->baseInfoRepository $baseInfoRepository;
  40.     }
  41.     /**
  42.      * @Route("/legal-information", name="legal_information", methods={"GET"})
  43.      */
  44.     public function index(Request $request)
  45.     {
  46.         // Load default layout for underlayer pages (ID = 2)
  47.         $Layout $this->layoutRepository->get(Layout::DEFAULT_LAYOUT_UNDERLAYER_PAGE);
  48.         // Get custom parameters using helper
  49.         $baseInfo $this->baseInfoRepository->get();
  50.         $customParams PageHelper::getLegalParams([
  51.             'page_title' => 'Legal Information',
  52.             'page_description' => 'Legal information and terms',
  53.             'show_company_info' => true,
  54.             'canonical_url' => $this->generateUrl('legal_information'),
  55.             'custom_meta_tags' => [
  56.                 'og:type' => 'website',
  57.                 'og:title' => 'Legal Information - ' $baseInfo->getShopName(),
  58.                 'og:description' => 'Legal information and terms',
  59.                 'og:url' => $this->generateUrl('legal_information', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL),
  60.             ]
  61.         ]);
  62.         return $this->render('Legal/index.twig', [
  63.             'Layout' => $Layout,
  64.             'custom_params' => $customParams,
  65.         ]);
  66.     }
  67. }