diff --git a/setup.php b/setup.php index 76bce93..c6b4408 100644 --- a/setup.php +++ b/setup.php @@ -260,6 +260,9 @@ function plugin_init_example() { $PLUGIN_HOOKS[Hooks::PRE_ITEM_FORM]['example'] = [ItemForm::class, 'preItemForm']; $PLUGIN_HOOKS[Hooks::POST_ITEM_FORM]['example'] = [ItemForm::class, 'postItemForm']; + $PLUGIN_HOOKS[Hooks::PRE_ITIL_INFO_SECTION]['example'] = [ItemForm::class, 'preSection']; + $PLUGIN_HOOKS[Hooks::POST_ITIL_INFO_SECTION]['example'] = [ItemForm::class, 'postSection']; + // Add new actions to timeline $PLUGIN_HOOKS[Hooks::TIMELINE_ACTIONS]['example'] = [ ItemForm::class, 'timelineActions' diff --git a/src/ItemForm.php b/src/ItemForm.php index 3920135..a6b882f 100644 --- a/src/ItemForm.php +++ b/src/ItemForm.php @@ -29,6 +29,8 @@ */ namespace GlpiPlugin\Example; + +use Glpi\Application\View\TemplateRenderer; use Html; use Ticket; @@ -39,6 +41,72 @@ use Ticket; * */ class ItemForm { + + /** + * Display contents at the begining of ITILObject section (right panel). + * + * @param array $params Array with "item" and "options" keys + * + * @return void + */ + static public function preSection($params) { + $item = $params['item']; + $options = $params['options']; + + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< +

+ +

+
+
+ Example pre section +
+
+ +TWIG, []); + + } + + /** + * Display contents at the end of ITILObject section (right panel). + * + * @param array $params Array with "item" and "options" keys + * + * @return void + */ + static public function postSection($params) { + $item = $params['item']; + $options = $params['options']; + + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< +

+ +

+
+
+ Example post section +
+
+ +TWIG, []); + } + + + + + /** * Display contents at the begining of item forms. *