mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 00:24:15 +02:00
- Plugins Controller implementation
This commit is contained in:
@@ -12,7 +12,6 @@ class PluginsController extends Controller
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
|
||||
return $this->view->render($response,
|
||||
'plugins/admin/views/templates/extends/plugins/index.html', [
|
||||
'plugins_list' => $this->registry->get('plugins'),
|
||||
@@ -20,9 +19,13 @@ class PluginsController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function update($request, $response, $args)
|
||||
public function changeStatus($request, $response, $args)
|
||||
{
|
||||
|
||||
$data = $request->getParsedBody();
|
||||
$plugin_settings = JsonParser::decode(Filesystem::read(PATH['plugins'] . '/' . $data['plugin'] . '/' . 'settings.json'));
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,3 +12,4 @@ $app->post('/admin/settings/clear-cache', 'SettingsController:clearCache')->setN
|
||||
|
||||
// Plugins Controller
|
||||
$app->get('/admin/plugins', 'PluginsController:index')->setName('admin.plugins.index');
|
||||
$app->post('/admin/plugins/change-status', 'PluginsController:changeStatus')->setName('admin.plugins.change-status');
|
||||
|
@@ -1,9 +1,8 @@
|
||||
{% extends "plugins/admin/views/partials/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form>
|
||||
<input type="hidden" name="url" value="{{ base_url() }}/admin/plugins/update">
|
||||
<input type="hidden" name="url" value="{{ base_url() }}/admin/plugins/change-status">
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user