From 160b767dc4b836d0be8e824afaf74693c49be328 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 28 May 2019 23:38:25 +0300 Subject: [PATCH] Flextype Box Plugin: Admin #125 #117 - Templates Controller/Views implementation --- .../admin/app/Controllers/TemplatesController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/site/plugins/admin/app/Controllers/TemplatesController.php b/site/plugins/admin/app/Controllers/TemplatesController.php index 755f3d37..4e0557e6 100644 --- a/site/plugins/admin/app/Controllers/TemplatesController.php +++ b/site/plugins/admin/app/Controllers/TemplatesController.php @@ -111,7 +111,21 @@ class TemplatesController extends Controller public function editProcess($request, $response, $args) { + $type = $request->getParsedBody()['type_current']; + if ($type == 'partial') { + $_type = '/templates/partials/'; + } else { + $_type = '/templates/'; + } + + if (Filesystem::write( PATH['themes'] . '/' . $this->registry->get('settings.theme') . $_type . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) { + $this->flash->addMessage('success', __('admin_message_'.$type.'_saved')); + } else { + $this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_saved')); + } + + return $response->withRedirect($this->container->get('router')->pathFor('admin.fieldsets.index')); } public function rename($request, $response, $args)