fix multiple calls of getCards hook

This commit is contained in:
adelaunay 2021-06-04 10:21:11 +02:00 committed by Cédric Anne
parent 0b61ae3bdd
commit 4e98b5065b

View File

@ -517,8 +517,11 @@ class PluginExampleExample extends CommonDBTM {
} }
static function dashboardCards() { static function dashboardCards($cards = []) {
return [ if (is_null($cards)) {
$cards = [];
}
$new_cards = [
'plugin_example_card' => [ 'plugin_example_card' => [
'widgettype' => ["example"], 'widgettype' => ["example"],
'label' => __("Plugin Example card"), 'label' => __("Plugin Example card"),
@ -534,6 +537,8 @@ class PluginExampleExample extends CommonDBTM {
'provider' => "PluginExampleExample::cardBigNumberProvider", 'provider' => "PluginExampleExample::cardBigNumberProvider",
], ],
]; ];
return array_merge($cards, $new_cards);
} }