app/Customize/Controller/PrivacyPolicyController.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 PrivacyPolicyController extends AbstractController
  21. {
  22.     /**
  23.      * @var LayoutRepository
  24.      */
  25.     protected $layoutRepository;
  26.     /**
  27.      * @var BaseInfoRepository
  28.      */
  29.     protected $baseInfoRepository;
  30.     /**
  31.      * PrivacyPolicyController 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("/privacy-policy", name="privacy_policy", 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.         
  49.         // Get custom parameters using helper
  50.         $baseInfo $this->baseInfoRepository->get();
  51.         $customParams PageHelper::getPrivacyPolicyParams([
  52.             'page_title' => 'Privacy Policy',
  53.             'page_description' => 'Privacy policy and data protection',
  54.             'show_company_info' => true,
  55.             'canonical_url' => $this->generateUrl('privacy_policy'),
  56.             'custom_meta_tags' => [
  57.                 'og:type' => 'website',
  58.                 'og:title' => 'Privacy Policy - ' $baseInfo->getShopName(),
  59.                 'og:description' => 'Privacy policy and data protection',
  60.                 'og:url' => $this->generateUrl('privacy_policy', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL),
  61.             ]
  62.         ]);
  63.         
  64.         return $this->render('PrivacyPolicy/index.twig', [
  65.             'Layout' => $Layout,
  66.             'custom_params' => $customParams,
  67.         ]);
  68.     }
  69. }