From b84c1471ea06ee8bce10fdd9d0e3d5b9a5c46511 Mon Sep 17 00:00:00 2001 From: uzulla Date: Sun, 8 Aug 2021 15:59:01 +0900 Subject: [PATCH] Avoid request params to use rendering HTML #338 --- app/src/Web/Controller/Admin/BlogTemplatesController.php | 4 +++- app/twig_templates/admin/blog_templates/edit.twig | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/Web/Controller/Admin/BlogTemplatesController.php b/app/src/Web/Controller/Admin/BlogTemplatesController.php index 40cc58ba..3b119972 100644 --- a/app/src/Web/Controller/Admin/BlogTemplatesController.php +++ b/app/src/Web/Controller/Admin/BlogTemplatesController.php @@ -177,13 +177,15 @@ public function edit(Request $request): string $id = $request->get('id'); $blog_id = $this->getBlogIdFromSession(); + $blog_template = $blog_templates_model->findByIdAndBlogId($id, $blog_id); // 初期表示時に編集データの取得&設定 if (!$request->get('blog_template') || !$request->isValidPost()) { - if (!$blog_template = $blog_templates_model->findByIdAndBlogId($id, $blog_id)) { + if (!$blog_template) { $this->redirect($request, ['action' => 'index']); } $request->set('blog_template', $blog_template); + $this->set('blog_template', $blog_template); return "admin/blog_templates/edit.twig"; } diff --git a/app/twig_templates/admin/blog_templates/edit.twig b/app/twig_templates/admin/blog_templates/edit.twig index dce989e4..a69a881c 100644 --- a/app/twig_templates/admin/blog_templates/edit.twig +++ b/app/twig_templates/admin/blog_templates/edit.twig @@ -7,7 +7,7 @@
- +

{{ _('Template name') }}