Filter disabled addons with "null"

This commit is contained in:
Philipp 2023-01-08 02:33:50 +01:00
parent 5ea50a9e81
commit 979672a3c1
No known key found for this signature in database
GPG key ID: 24A7501396EB5432

View file

@ -84,7 +84,7 @@ class Addon
public static function getAdminList(): array public static function getAdminList(): array
{ {
$addons_admin = []; $addons_admin = [];
$addons = DI::config()->get('addons') ?? []; $addons = array_filter(DI::config()->get('addons') ?? []);
ksort($addons); ksort($addons);
foreach ($addons as $name => $data) { foreach ($addons as $name => $data) {
@ -117,7 +117,7 @@ class Addon
*/ */
public static function loadAddons() public static function loadAddons()
{ {
self::$addons = array_keys(DI::config()->get('addons') ?? []); self::$addons = array_keys(array_filter(DI::config()->get('addons') ?? []));
} }
/** /**
@ -192,7 +192,7 @@ class Addon
*/ */
public static function reload() public static function reload()
{ {
$addons = DI::config()->get('addons') ?? []; $addons = array_filter(DI::config()->get('addons') ?? []);
foreach ($addons as $name => $data) { foreach ($addons as $name => $data) {
$addonname = Strings::sanitizeFilePathItem(trim($name)); $addonname = Strings::sanitizeFilePathItem(trim($name));
@ -315,7 +315,7 @@ class Addon
public static function getVisibleList(): array public static function getVisibleList(): array
{ {
$visible_addons = []; $visible_addons = [];
$addons = DI::config()->get('addons') ?? []; $addons = array_filter(DI::config()->get('addons') ?? []);
foreach ($addons as $name => $data) { foreach ($addons as $name => $data) {
$visible_addons[] = $name; $visible_addons[] = $name;