castopod/modules/Plugins/Helpers/plugins_helper.php
Yassine Doghri 0eba234628 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
2024-05-01 14:48:05 +00:00

25 lines
630 B
PHP

<?php
declare(strict_types=1);
if (! function_exists('get_plugin_option')) {
function get_plugin_option(string $pluginKey, string $option): mixed
{
$key = sprintf('Plugins.%s', $option);
$context = sprintf('plugin:%s', $pluginKey);
return setting()->get($key, $context);
}
}
if (! function_exists('set_plugin_option')) {
function set_plugin_option(string $pluginKey, string $option, mixed $value = null): void
{
$key = sprintf('Plugins.%s', $option);
$context = sprintf('plugin:%s', $pluginKey);
setting()
->set($key, $value, $context);
}
}