mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
Add an example for Hooks::SET_ITEM_IMPACT_ICON
This commit is contained in:
parent
3e3ba0128f
commit
115c355eb2
11
hook.php
11
hook.php
@ -703,3 +703,14 @@ function plugin_example_filter_actors(array $params = []): array {
|
|||||||
|
|
||||||
return $params;
|
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;
|
||||||
|
}
|
||||||
|
5
public/computer_icon.svg
Normal file
5
public/computer_icon.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 5.8 KiB |
@ -258,6 +258,9 @@ function plugin_init_example() {
|
|||||||
$PLUGIN_HOOKS[Hooks::DASHBOARD_FILTERS]['example'] = [
|
$PLUGIN_HOOKS[Hooks::DASHBOARD_FILTERS]['example'] = [
|
||||||
ComputerModelFilter::class
|
ComputerModelFilter::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Icon in the impact analysis
|
||||||
|
$PLUGIN_HOOKS[Hooks::SET_ITEM_IMPACT_ICON]['example'] = 'plugin_example_set_impact_icon';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user