* Returns a list of addons that can be configured at the node level.
* The list is formatted for display in the admin panel aside.
*
+ * @deprecated 2025.02 Use `Friendica\Core\Addon\AddonHelper::getEnabledAddonsWithAdminSettings()` instead
+ *
* @return array
* @throws \Exception
*/
*
* @return bool true on success or false on failure
*/
- public function installAdodn(string $addonId): bool;
+ public function installAddon(string $addonId): bool;
/**
* Uninstalls an addon.
*
* @return string[]
*/
- public static function getVisibleEnabledAddons(): array;
+ public function getVisibleEnabledAddons(): array;
+
+ /**
+ * Returns a list with the IDs of the enabled addons that provides admin settings.
+ *
+ * @return string[]
+ */
+ public function getEnabledAddonsWithAdminSettings(): array;
}
*
* @return bool true on success or false on failure
*/
- public function installAdodn(string $addonId): bool
+ public function installAddon(string $addonId): bool
{
return Addon::install($addonId);
}
*
* @return string[]
*/
- public static function getVisibleEnabledAddons(): array
+ public function getVisibleEnabledAddons(): array
{
return Addon::getVisibleList();
}
+
+ /**
+ * Returns a list with the IDs of the enabled addons that provides admin settings.
+ *
+ * @return string[]
+ */
+ public function getEnabledAddonsWithAdminSettings(): array
+ {
+ return array_keys(Addon::getAdminList());
+ }
}
namespace Friendica\Module\Admin\Addons;
use Friendica\Content\Text\Markdown;
-use Friendica\Core\Addon;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\BaseAdmin;
$addonHelper = DI::addonHelper();
- $addons_admin = Addon::getAdminList();
-
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) {
DI::sysmsg()->addNotice(DI::l10n()->t('Addon not found.'));
$addonHelper->uninstallAddon($addon);
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
} else {
- $addonHelper->installAdodn($addon);
+ $addonHelper->installAddon($addon);
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
}
$readme = '<pre>' . file_get_contents("addon/$addon/README") . '</pre>';
}
+ $addons_admin = $addonHelper->getEnabledAddonsWithAdminSettings();
+
$admin_form = '';
- if (array_key_exists($addon, $addons_admin)) {
+ if (in_array($addon, $addons_admin)) {
require_once "addon/$addon/$addon.php";
$func = $addon . '_addon_admin';
$func($admin_form);