add setting to hide distributed modules from lists
parent
3153c4b751
commit
0bd77b1399
|
@ -88,6 +88,13 @@ class Config extends dcNsProcess
|
|||
# -- Display form --
|
||||
echo
|
||||
(new Div())->items([
|
||||
(new Fieldset())->class('fieldset')->legend((new Legend(__('Interface'))))->fields([
|
||||
// hide_distrib
|
||||
(new Para())->items([
|
||||
(new Checkbox('hide_distrib', $s->hide_distrib))->value(1),
|
||||
(new Label(__('Hide distributed modules from lists'), Label::OUTSIDE_LABEL_AFTER))->for('hide_distrib')->class('classic'),
|
||||
]),
|
||||
]),
|
||||
(new Fieldset())->class('fieldset')->legend((new Legend(__('Root'))))->fields([
|
||||
// pack_repository
|
||||
(new Para())->items([
|
||||
|
|
|
@ -39,6 +39,9 @@ class Settings
|
|||
// Extra files to exclude from package
|
||||
public readonly string $pack_excludefiles;
|
||||
|
||||
// Hide distributed modules from lists
|
||||
public readonly bool $hide_distrib;
|
||||
|
||||
/**
|
||||
* Constructor set up plugin settings
|
||||
*/
|
||||
|
@ -53,6 +56,7 @@ class Settings
|
|||
$this->secondpack_filename = (string) ($s->get('secondpack_filename') ?? '%type%-%id%-%version%');
|
||||
$this->pack_repository = (string) ($s->get('pack_repository') ?? '');
|
||||
$this->pack_excludefiles = (string) ($s->get('pack_excludefiles') ?? '*.zip,*.tar,*.tar.gz,.directory,.hg');
|
||||
$this->hide_distrib = (bool) ($s->get('hide_distrib') ?? false);
|
||||
}
|
||||
|
||||
public function getSetting(string $key): mixed
|
||||
|
|
|
@ -98,6 +98,10 @@ class Utils
|
|||
|
||||
$modules = array_merge(dcCore::app()->{$type}->getDisabledModules(), dcCore::app()->{$type}->getModules());
|
||||
|
||||
if ((new Settings())->hide_distrib) {
|
||||
$modules = array_diff_key($modules, array_flip(array_values(array_merge(explode(',', DC_DISTRIB_PLUGINS), explode(',', DC_DISTRIB_THEMES)))));
|
||||
}
|
||||
|
||||
if (empty($id)) {
|
||||
return $modules;
|
||||
} elseif (array_key_exists($id, $modules)) {
|
||||
|
|
Loading…
Reference in New Issue