diff --git a/hook.php b/hook.php index 26bf722..73e0af8 100644 --- a/hook.php +++ b/hook.php @@ -703,3 +703,14 @@ function plugin_example_filter_actors(array $params = []): array { return $params; } + +function plugin_example_set_impact_icon(array $params) { + $itemtype = $params['itemtype']; + $items_id = $params['items_id']; + + $item = getItemForItemtype($itemtype); + if ($item instanceof Computer && $item->getFromDB($items_id)) { + return Plugin::getWebDir('example', true, false) . '/public/computer_icon.svg'; + } + return null; +} diff --git a/public/computer_icon.svg b/public/computer_icon.svg new file mode 100644 index 0000000..66dc522 --- /dev/null +++ b/public/computer_icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/setup.php b/setup.php index 8c61150..f80a312 100644 --- a/setup.php +++ b/setup.php @@ -258,6 +258,9 @@ function plugin_init_example() { $PLUGIN_HOOKS[Hooks::DASHBOARD_FILTERS]['example'] = [ ComputerModelFilter::class ]; + + // Icon in the impact analysis + $PLUGIN_HOOKS[Hooks::SET_ITEM_IMPACT_ICON]['example'] = 'plugin_example_set_impact_icon'; }