Skip to content

Commit

Permalink
Avoid request params to use rendering HTML fc2blog#338
Browse files Browse the repository at this point in the history
  • Loading branch information
uzulla committed Aug 8, 2021
1 parent d84abbd commit b84c147
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/src/Web/Controller/Admin/BlogTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
2 changes: 1 addition & 1 deletion app/twig_templates/admin/blog_templates/edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<form action="edit" method="post" id="sys-blog-template-form" class="admin-form">

<input type="hidden" name="id" value="{{ req.get('id') }}"/>
<input type="hidden" name="id" value="{{ blog_template.id }}"/>
<input type="hidden" name="sig" value="{{ sig }}"/>

<h3>{{ _('Template name') }}</h3>
Expand Down

0 comments on commit b84c147

Please sign in to comment.