1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-18 10:51:21 +02:00

Flextype Admin Panel: Plugins #165

- refactoring
This commit is contained in:
Awilum
2019-06-24 21:59:01 +03:00
parent 588788ad2b
commit d121254d3e

View File

@@ -61,13 +61,18 @@ class PluginsController extends Controller
*/
public function pluginStatusProcess(Request $request, Response $response) : Response
{
// Get data from the request
$data = $request->getParsedBody();
// Update settings
$plugin_settings = JsonParser::decode(Filesystem::read(PATH['plugins'] . '/' . $data['plugin-key'] . '/' . 'settings.json'));
Arr::set($plugin_settings, 'enabled', ($data['plugin-status'] == 'true' ? true : false));
Filesystem::write(PATH['plugins'] . '/' . $data['plugin-key'] . '/' . 'settings.json', JsonParser::encode($plugin_settings));
// Clear doctrine cache
$this->cache->clear('doctrine');
// Redirect to plugins index page
return $response->withRedirect($this->router->pathFor('admin.plugins.index'));
}
}