diff --git a/inc/itemform.class.php b/inc/itemform.class.php index 77dcaa7..8e7274f 100644 --- a/inc/itemform.class.php +++ b/inc/itemform.class.php @@ -117,4 +117,28 @@ class PluginExampleItemForm { echo $out; } + + static public function timelineActions($params = []) { + $rand = $params['rand']; + $ticket = $params['item']; + + if (get_class($ticket) !== "Ticket") { + return false; + } + + $edit_panel = "viewitem".$ticket->fields['id'].$rand; + $JS = << + ". + __("Send a notification"). + Html::scriptBlock($JS)." + "; + } } diff --git a/setup.php b/setup.php index 9f4b21a..0e32dd6 100755 --- a/setup.php +++ b/setup.php @@ -204,6 +204,11 @@ function plugin_init_example() { $PLUGIN_HOOKS['pre_item_form']['example'] = ['PluginExampleItemForm', 'preItemForm']; $PLUGIN_HOOKS['post_item_form']['example'] = ['PluginExampleItemForm', 'postItemForm']; + // Add new actions to timeline + $PLUGIN_HOOKS['timeline_actions']['example'] = [ + 'PluginExampleItemForm', 'timelineActions' + ]; + // declare this plugin as an import plugin for Computer itemtype $PLUGIN_HOOKS['import_item']['example'] = ['Computer' => ['Plugin']];