<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Controller;
use Eccube\Controller\AbstractController;
use Eccube\Repository\LayoutRepository;
use Eccube\Entity\Layout;
use Eccube\Repository\BaseInfoRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Customize\Helper\PageHelper;
class PrivacyPolicyController extends AbstractController
{
/**
* @var LayoutRepository
*/
protected $layoutRepository;
/**
* @var BaseInfoRepository
*/
protected $baseInfoRepository;
/**
* PrivacyPolicyController constructor.
*
* @param LayoutRepository $layoutRepository
* @param BaseInfoRepository $baseInfoRepository
*/
public function __construct(LayoutRepository $layoutRepository, BaseInfoRepository $baseInfoRepository)
{
$this->layoutRepository = $layoutRepository;
$this->baseInfoRepository = $baseInfoRepository;
}
/**
* @Route("/privacy-policy", name="privacy_policy", methods={"GET"})
*/
public function index(Request $request)
{
// Load default layout for underlayer pages (ID = 2)
$Layout = $this->layoutRepository->get(Layout::DEFAULT_LAYOUT_UNDERLAYER_PAGE);
// Get custom parameters using helper
$baseInfo = $this->baseInfoRepository->get();
$customParams = PageHelper::getPrivacyPolicyParams([
'page_title' => 'Privacy Policy',
'page_description' => 'Privacy policy and data protection',
'show_company_info' => true,
'canonical_url' => $this->generateUrl('privacy_policy'),
'custom_meta_tags' => [
'og:type' => 'website',
'og:title' => 'Privacy Policy - ' . $baseInfo->getShopName(),
'og:description' => 'Privacy policy and data protection',
'og:url' => $this->generateUrl('privacy_policy', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL),
]
]);
return $this->render('PrivacyPolicy/index.twig', [
'Layout' => $Layout,
'custom_params' => $customParams,
]);
}
}