mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-05 02:18:42 +02:00
new hook pre_item_add2
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@173 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
acf0490727
commit
43be7e4a18
@ -128,16 +128,21 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on before add item case
|
// Hook done on before add item case (data from form, not altered)
|
||||||
static function pre_item_add_example($item) {
|
static function pre_item_add_example($item) {
|
||||||
Session::addMessageAfterRedirect("Pre Add Computer Hook", true);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on add item case
|
// Hook done on add item case
|
||||||
static function item_add_example($item) {
|
static function item_add_example($item) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Add Computer Hook, ID=".$item->getField('id'), true);
|
Session::addMessageAfterRedirect("Add Computer Hook, ID=".$item->getID(), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ function plugin_init_example() {
|
|||||||
// Example using a method in class
|
// Example using a method in class
|
||||||
$PLUGIN_HOOKS['pre_item_add']['example'] = array('Computer' => array('PluginExampleExample',
|
$PLUGIN_HOOKS['pre_item_add']['example'] = array('Computer' => array('PluginExampleExample',
|
||||||
'pre_item_add_example'));
|
'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',
|
$PLUGIN_HOOKS['item_add']['example'] = array('Computer' => array('PluginExampleExample',
|
||||||
'item_add_example'));
|
'item_add_example'));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user