From 72e3f7e4674f9465938c2be72dee4ceb586d4cd5 Mon Sep 17 00:00:00 2001 From: dakeyama Date: Mon, 28 Dec 2020 11:19:26 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E5=90=8D=E5=89=8D=E7=A9=BA=E9=96=93=E3=81=AE=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=BC=E3=83=88=E3=82=92=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/Admin/Content/PageController.php | 14 ++++++++++++-- src/Eccube/Form/Type/Admin/MainEditType.php | 2 +- .../Resource/template/admin/Content/page_edit.twig | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Eccube/Controller/Admin/Content/PageController.php b/src/Eccube/Controller/Admin/Content/PageController.php index 48d7607feb9..b9f856d16f9 100644 --- a/src/Eccube/Controller/Admin/Content/PageController.php +++ b/src/Eccube/Controller/Admin/Content/PageController.php @@ -159,7 +159,12 @@ public function edit(Request $request, $id = null, Environment $twig, RouterInte if ($isUserDataPage) { $templatePath = $this->getParameter('eccube_theme_user_data_dir'); } else { - $templatePath = $this->getParameter('eccube_theme_front_dir'); + if (preg_match('/^@/', $Page->getFileName(), $matches)) { + // file_nameが@で始まる場合プラグインの名前空間とみなす + $templatePath = $this->getParameter('eccube_theme_app_dir').'/plugin'; + } else { + $templatePath = $this->getParameter('eccube_theme_front_dir'); + } } $filePath = $templatePath.'/'.$Page->getFileName().'.twig'; @@ -235,7 +240,12 @@ public function edit(Request $request, $id = null, Environment $twig, RouterInte $templatePath = $this->getParameter('eccube_theme_user_data_dir'); $url = ''; } else { - $templatePath = $this->getParameter('eccube_theme_front_dir'); + if (preg_match('/^@/', $PrevPage->getFileName())) { + // file_nameが@で始まる場合プラグインの名前空間とみなす + $templatePath = $this->getParameter('eccube_theme_app_dir').'/plugin'; + } else { + $templatePath = $this->getParameter('eccube_theme_front_dir'); + } $url = $router->getRouteCollection()->get($PrevPage->getUrl())->getPath(); } $projectDir = $this->getParameter('kernel.project_dir'); diff --git a/src/Eccube/Form/Type/Admin/MainEditType.php b/src/Eccube/Form/Type/Admin/MainEditType.php index 9a41ef7bfea..a9de73f918f 100644 --- a/src/Eccube/Form/Type/Admin/MainEditType.php +++ b/src/Eccube/Form/Type/Admin/MainEditType.php @@ -101,7 +101,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'max' => $this->eccubeConfig['eccube_stext_len'], ]), new Assert\Regex([ - 'pattern' => '/^([0-9a-zA-Z_\-]+\/?)+$/', + 'pattern' => '/^@?([0-9a-zA-Z_\-]+\/?)+$/', ]), ], ]) diff --git a/src/Eccube/Resource/template/admin/Content/page_edit.twig b/src/Eccube/Resource/template/admin/Content/page_edit.twig index 3d33dec3776..556404fe472 100644 --- a/src/Eccube/Resource/template/admin/Content/page_edit.twig +++ b/src/Eccube/Resource/template/admin/Content/page_edit.twig @@ -133,7 +133,7 @@ file that was distributed with this source code.
.twig
{% else %}
- {{ template_path }}/{{ form.file_name.vars.value }}.twig + {{ template_path }}/{{ form.file_name.vars.value|replace({'@' : ''}) }}.twig
{{ form_widget(form.file_name, { type : 'hidden' } ) }}
{% endif %}