app/Customize/Controller/TopController.php line 55

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 Customize\Controller\LM\LmAbstractController;
  14. use Customize\Entity\CacheTrait;
  15. use Customize\Service\LmHelper;
  16. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  17. use Symfony\Component\Routing\Annotation\Route;
  18. use Customize\Converter\DynamicConverter;
  19. use Customize\Service\CommonService;
  20. use Eccube\Common\EccubeConfig;
  21. use Symfony\Component\HttpFoundation\Request;
  22. class TopController extends LmAbstractController
  23. {
  24.     use CacheTrait;
  25.     protected $DynamicConverter;
  26.     protected $EccubeConfig;
  27.     public function __construct(
  28.         CommonService $CommonService,
  29.         LmHelper $LmHelper,
  30.         DynamicConverter $DynamicConverter,
  31.         EccubeConfig $EccubeConfig
  32.     )
  33.     {
  34.         //
  35.         parent::__construct($CommonService$LmHelper);
  36.         //
  37.         $this->DynamicConverter $DynamicConverter;
  38.         $this->EccubeConfig $EccubeConfig;
  39.     }
  40.     /**
  41.      * @Route("/", name="homepage", methods={"GET"})
  42.      * @param Request $request
  43.      * @Template("Top/index.twig")
  44.      * @return array
  45.      */
  46.     public function index(Request $request)
  47.     {
  48.         //
  49.         $device strtolower($this->CommonService->GetDevice());
  50.         //
  51.         $masterCacheKey self::getMasterCacheKey();
  52.         // TODO: $suffix
  53.         $suffix '';
  54.         //
  55.         $viewCacheKey "{$masterCacheKey}__{$device}_view__{$suffix}";
  56.         //
  57.         $masterCache $this->handleMasterCache($masterCacheKey$device, [
  58.             $viewCacheKey,
  59.         ]);
  60.         //
  61.         return $this->getCacheByKey($viewCacheKey, function () {
  62.             //
  63.             return $this->_index();
  64.         });
  65.     }
  66.     /**
  67.      * @param Request $request
  68.      * @return array
  69.      */
  70.     public function _index()
  71.     {
  72.         $upperColumnData $this->DynamicConverter->getUpperColumnByCategory()['upper_one_column_content'] ?? null;
  73.         $mainContent['pc_content_html'] = $this->DynamicConverter->getPageContent('pc''top''main')['pc_content_html'];
  74.         $mainContent['pc_content_html'] = str_replace('alt="0"''alt="0" width="18px" height="22px"'$mainContent['pc_content_html']);
  75.         $mainContent['pc_content_html'] = str_replace('src="https://img0.land-mark.biz/ut_img/public_images/top/main_banner/saitan.png"''src="https://img0.land-mark.biz/ut_img/public_images/top/main_banner/saitan.png" width="30px" height="15px"'$mainContent['pc_content_html']);
  76.         $mainContent['pc_content_html'] = str_replace('src="https://img0.land-mark.biz/ut_img/public_images/categorypage/banner/work/work-burtle-reservation-2022aw-nyuuka-1col.jpg"''src="https://img0.land-mark.biz/ut_img/public_images/categorypage/banner/work/work-burtle-reservation-2022aw-nyuuka-1col.jpg" width="805px" height="200px"'$mainContent['pc_content_html']);
  77.         $mainContent['pc_content_html'] = str_replace('src="https://img0.land-mark.biz/ut_img/public_images/categorypage/banner/work/work-burtle-reservation-2022ss-nyuuka-1col.jpg"''src="https://img0.land-mark.biz/ut_img/public_images/categorypage/banner/work/work-burtle-reservation-2022ss-nyuuka-1col.jpg" width="805px" height="200px"'$mainContent['pc_content_html']);
  78.         $mainContent['sp_content_html'] = $this->DynamicConverter->getPageContent('sp''top''main')['pc_content_html'];
  79.         $visitSubCategoryList $this->DynamicConverter->getVisitSubCategoryList();
  80.         $messageList $this->DynamicConverter->getMessageList(''51);
  81.         $custom_menu $this->DynamicConverter->getMenuGroup($this->EccubeConfig['EditSpMenu']['MENU_NAME_COMMON'], $this->EccubeConfig['EditSpMenu']['BOOL_TRUE']);
  82.         $custom_frequently_searched_word $this->DynamicConverter->getSearchWordGroup($this->EccubeConfig['EditSpMenu']['MENU_NAME_COMMON'], $this->EccubeConfig['EditSpMenu']['BOOL_TRUE']);
  83.         $updatedContent true;
  84.         return [
  85.             'mainContent' => $mainContent,
  86.             'upperColumnData' => $upperColumnData,
  87.             'visitSubCategoryList' => $visitSubCategoryList,
  88.             'messageList' => $messageList,
  89.             'custom_menu' => $custom_menu,
  90.             'custom_frequently_searched_word' => $custom_frequently_searched_word,
  91.             'updatedContent' => $updatedContent,
  92.             'dataLayer' => $this->dataLayer,
  93.         ];
  94.     }
  95.     /**
  96.      * #Route("/top", name="top", methods={"GET"})
  97.      * @Template()
  98.      */
  99.     public function top(Request $request)
  100.     {
  101.         return $this->redirectToRoute('homepage');
  102.     }
  103.     /**
  104.      * @return string
  105.      */
  106.     public static function getMasterCacheKey()
  107.     {
  108.         //
  109.         $masterCacheKey "index_index";
  110.         //
  111.         $masterCacheKey str_replace('-''_'$masterCacheKey);
  112.         //
  113.         return $masterCacheKey;
  114.     }
  115. }