diff --git a/inc/example.class.php b/inc/example.class.php index 6b54c71..7795e1f 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -129,18 +129,18 @@ class PluginExampleExample extends CommonDBTM { // Hook done on before add item case (data from form, not altered) - static function pre_item_add_example($item) { + static function pre_item_add_computer(Computer $item) { Session::addMessageAfterRedirect("Pre Add Computer Hook", true); } // Hook done on before add item case (data altered by object prepareInputForAdd) - static function pre_item_add2_example($item) { - Session::addMessageAfterRedirect("Pre Add2 Computer Hook", true); + static function post_prepareadd_computer(Computer$item) { + Session::addMessageAfterRedirect("Post prepareAdd Computer Hook", true); } // Hook done on add item case - static function item_add_example($item) { + static function item_add_computer(Computer$item) { Session::addMessageAfterRedirect("Add Computer Hook, ID=".$item->getID(), true); return true; diff --git a/setup.php b/setup.php index cffdbaa..53d6075 100755 --- a/setup.php +++ b/setup.php @@ -91,12 +91,12 @@ function plugin_init_example() { $PLUGIN_HOOKS['item_empty']['example'] = array('Computer' => 'plugin_item_empty_example'); // Example using a method in class - $PLUGIN_HOOKS['pre_item_add']['example'] = array('Computer' => array('PluginExampleExample', - 'pre_item_add_example')); - $PLUGIN_HOOKS['pre_item_add2']['example'] = array('Computer' => array('PluginExampleExample', - 'pre_item_add2_example')); - $PLUGIN_HOOKS['item_add']['example'] = array('Computer' => array('PluginExampleExample', - 'item_add_example')); + $PLUGIN_HOOKS['pre_item_add']['example'] = array('Computer' => array('PluginExampleExample', + 'pre_item_add_computer')); + $PLUGIN_HOOKS['post_prepareadd']['example'] = array('Computer' => array('PluginExampleExample', + 'post_prepareadd_computer')); + $PLUGIN_HOOKS['item_add']['example'] = array('Computer' => array('PluginExampleExample', + 'item_add_computer')); $PLUGIN_HOOKS['pre_item_delete']['example'] = array('Computer' => 'plugin_pre_item_delete_example'); $PLUGIN_HOOKS['item_delete']['example'] = array('Computer' => 'plugin_item_delete_example');