Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ページ管理] プラグイン名前空間のファイル名でもテンプレート編集可能に #4905

Open
wants to merge 1 commit into
base: 4.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Eccube/Controller/Admin/Content/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Form/Type/Admin/MainEditType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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_\-]+\/?)+$/',
]),
],
])
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Resource/template/admin/Content/page_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ file that was distributed with this source code.
<div class="col-2 pl-0">.twig</div>
{% else %}
<div class="col pr-0 align-middle">
<span class="align-middle">{{ template_path }}/{{ form.file_name.vars.value }}.twig</span>
<span class="align-middle">{{ template_path }}/{{ form.file_name.vars.value|replace({'@' : ''}) }}.twig</span>
<div>{{ form_widget(form.file_name, { type : 'hidden' } ) }}</div>
</div>
{% endif %}
Expand Down