From 4e98b5065bfc50b6bdad44814b24cbdf8c8c7182 Mon Sep 17 00:00:00 2001 From: adelaunay Date: Fri, 4 Jun 2021 10:21:11 +0200 Subject: [PATCH] fix multiple calls of getCards hook --- inc/example.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/example.class.php b/inc/example.class.php index 514f208..51a36fe 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -517,8 +517,11 @@ class PluginExampleExample extends CommonDBTM { } - static function dashboardCards() { - return [ + static function dashboardCards($cards = []) { + if (is_null($cards)) { + $cards = []; + } + $new_cards = [ 'plugin_example_card' => [ 'widgettype' => ["example"], 'label' => __("Plugin Example card"), @@ -534,6 +537,8 @@ class PluginExampleExample extends CommonDBTM { 'provider' => "PluginExampleExample::cardBigNumberProvider", ], ]; + + return array_merge($cards, $new_cards); }