mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-13 19:47:45 +02:00
feat(plugins): activate / deactivate plugin using settings table
+ load plugin icon + add pagination + autoload plugins in Config/Autoload.php to handle plugin i18n + style plugin cards
This commit is contained in:
parent
587938d2bf
commit
27d2a1b0ff
16 changed files with 406 additions and 42 deletions
46
modules/Plugins/Controllers/PluginsController.php
Normal file
46
modules/Plugins/Controllers/PluginsController.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Plugins\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use Modules\Admin\Controllers\BaseController;
|
||||
use Modules\Plugins\Plugins;
|
||||
|
||||
class PluginsController extends BaseController
|
||||
{
|
||||
public function installed(): string
|
||||
{
|
||||
/** @var Plugins $plugins */
|
||||
$plugins = service('plugins');
|
||||
|
||||
$pager = service('pager');
|
||||
|
||||
$page = (int) ($this->request->getGet('page') ?? 1);
|
||||
$perPage = 10;
|
||||
$total = $plugins->getInstalledCount();
|
||||
|
||||
$pager_links = $pager->makeLinks($page, $perPage, $total);
|
||||
|
||||
return view('plugins/installed', [
|
||||
'total' => $total,
|
||||
'plugins' => $plugins->getPlugins($page, $perPage),
|
||||
'pager_links' => $pager_links,
|
||||
]);
|
||||
}
|
||||
|
||||
public function activate(string $pluginKey): RedirectResponse
|
||||
{
|
||||
service('plugins')->activate($pluginKey);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function deactivate(string $pluginKey): RedirectResponse
|
||||
{
|
||||
service('plugins')->deactivate($pluginKey);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue