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-07 23:43:25 +03:00
parent 2cd65d0f20
commit 15dbe53a96

View File

@@ -5,12 +5,21 @@ namespace Flextype;
use Flextype\Component\Filesystem\Filesystem;
use Flextype\Component\Date\Date;
use Flextype\Component\Arr\Arr;
use Flextype\Component\Registry\Registry;
use function Flextype\Component\I18n\__;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class SettingsController extends Controller
{
public function index($request, $response)
/**
* Index page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function index(Request $request, Response $response) : Response
{
$entries = [];
foreach ($this->entries->fetchAll('', 'date', 'DESC') as $entry) {
@@ -78,7 +87,15 @@ class SettingsController extends Controller
);
}
public function update($request, $response)
/**
* Update settings process
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function updateSettingsProcess(Request $request, Response $response) : Response
{
$data = $request->getParsedBody();
@@ -102,7 +119,15 @@ class SettingsController extends Controller
return $response->withRedirect($this->container->get('router')->pathFor('admin.settings.index'));
}
public function clearCache($request, $response)
/**
* Clear cache process
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function clearCacheProcess(Request $request, Response $response) : Response
{
Cache::clear();
$this->flash->addMessage('success', __('admin_message_cache_files_deleted'));