aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Dashboard
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-27 07:25:01 +0200
committerJoas Schilling <coding@schilljs.com>2022-10-27 07:25:25 +0200
commit23171206b4fe8ffa1e2360a547af61bcb034e4da (patch)
treef2adfd9e8f843d568e09a566c0b5f39573565ee4 /lib/private/Dashboard
parent71493433b826afd67093c04ce29efc2c12242a2a (diff)
downloadnextcloud-server-23171206b4fe8ffa1e2360a547af61bcb034e4da.tar.gz
nextcloud-server-23171206b4fe8ffa1e2360a547af61bcb034e4da.zip
Allow to conditionally enable dashboard widgets
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Dashboard')
-rw-r--r--lib/private/Dashboard/Manager.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php
index 2aeedf3174e..da8da30ce8f 100644
--- a/lib/private/Dashboard/Manager.php
+++ b/lib/private/Dashboard/Manager.php
@@ -28,6 +28,7 @@ namespace OC\Dashboard;
use InvalidArgumentException;
use OCP\App\IAppManager;
+use OCP\Dashboard\IConditionalWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
use Psr\Container\ContainerExceptionInterface;
@@ -91,6 +92,10 @@ class Manager implements IManager {
* type, so we might get a TypeError here that we should catch.
*/
try {
+ if ($widget instanceof IConditionalWidget && !$widget->isEnabled()) {
+ continue;
+ }
+
$this->registerWidget($widget);
} catch (Throwable $e) {
/*