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.
This commit is contained in:
Andreas Gohr 2024-04-16 13:48:47 +02:00
parent 821c061a6c
commit 31afae8a52
2 changed files with 11 additions and 0 deletions

View File

@ -59,6 +59,16 @@ abstract class AdminPlugin extends Plugin
return 1000;
}
/**
* Return true if the plugin should be shown in the admin menu
*
* @return bool
*/
public function showInMenu()
{
return true;
}
/**
* Carry out required processing
*/

View File

@ -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';