1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-28 23:40:41 +02:00

Flextype Box Plugin: Admin #125 #117

- fixes and refactoring
This commit is contained in:
Awilum
2019-06-08 01:02:57 +03:00
parent a3aa6f62a0
commit 16d4baecbb
2 changed files with 45 additions and 4 deletions

View File

@@ -66,5 +66,7 @@ class PluginsController extends Controller
Arr::set($plugin_settings, 'enabled', ($data['status'] == 'true' ? true : false));
Filesystem::write(PATH['plugins'] . '/' . $data['plugin'] . '/' . 'settings.json', JsonParser::encode($plugin_settings));
$this->cache->clear();
return $response;
}
}

View File

@@ -5,10 +5,25 @@ namespace Flextype;
use Flextype\Component\Filesystem\Filesystem;
use Flextype\Component\Text\Text;
use function Flextype\Component\I18n\__;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
/**
* @property View $view
* @property Router $router
* @property Snippets $snippets
*/
class SnippetsController extends Controller
{
public function index($request, $response)
/**
* Index page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function index(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response
{
return $this->view->render(
$response,
@@ -34,7 +49,15 @@ class SnippetsController extends Controller
);
}
public function add($request, $response)
/**
* Add snippet
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function add(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response
{
return $this->view->render(
$response,
@@ -52,7 +75,15 @@ class SnippetsController extends Controller
);
}
public function addProcess($request, $response)
/**
* Add snippet process
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function addProcess(Request $request, Response $response) : Response
{
if ($this->snippets->create($request->getParsedBody()['id'], "")) {
$this->flash->addMessage('success', __('admin_message_snippet_created'));
@@ -63,7 +94,15 @@ class SnippetsController extends Controller
return $response->withRedirect($this->container->get('router')->pathFor('admin.snippets.index'));
}
public function edit($request, $response)
/**
* Edit snippet
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function edit(Request $request, Response $response) : Response
{
return $this->view->render(
$response,