From 31afae8a5238b24d15fc0e6f342ee8341d1014dd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 16 Apr 2024 13:48:47 +0200 Subject: [PATCH] allow admin components to skip being shown in the admin menu This is related to #4249. At least the farmer plugin provides a top level admin component and several sub components which are loaded from the top component. For this use case it makes sense to be able to hide components from the admin interface. Default remains to show all. --- inc/Extension/AdminPlugin.php | 10 ++++++++++ inc/Ui/Admin.php | 1 + 2 files changed, 11 insertions(+) diff --git a/inc/Extension/AdminPlugin.php b/inc/Extension/AdminPlugin.php index 099a83623..69c5ff867 100644 --- a/inc/Extension/AdminPlugin.php +++ b/inc/Extension/AdminPlugin.php @@ -60,6 +60,16 @@ abstract class AdminPlugin extends Plugin } /** + * Return true if the plugin should be shown in the admin menu + * + * @return bool + */ + public function showInMenu() + { + return true; + } + + /** * Carry out required processing */ public function handle() diff --git a/inc/Ui/Admin.php b/inc/Ui/Admin.php index 9e300d835..3ec635b23 100644 --- a/inc/Ui/Admin.php +++ b/inc/Ui/Admin.php @@ -135,6 +135,7 @@ class Admin extends Ui // check permissions if (!$obj->isAccessibleByCurrentUser()) continue; + if (!$obj->showInMenu()) continue; if (in_array($p, $this->forAdmins, true)) { $type = 'admin'; -- 2.11.4.GIT