|
29 | 29 | */ |
30 | 30 |
|
31 | 31 | namespace GlpiPlugin\Example; |
| 32 | + |
| 33 | +use Glpi\Application\View\TemplateRenderer; |
32 | 34 | use Html; |
33 | 35 | use Ticket; |
34 | 36 |
|
|
39 | 41 | * */ |
40 | 42 | class ItemForm { |
41 | 43 |
|
| 44 | + |
| 45 | + /** |
| 46 | + * Display contents at the begining of ITILObject section (right panel). |
| 47 | + * |
| 48 | + * @param array $params Array with "item" and "options" keys |
| 49 | + * |
| 50 | + * @return void |
| 51 | + */ |
| 52 | + static public function preSection($params) { |
| 53 | + $item = $params['item']; |
| 54 | + $options = $params['options']; |
| 55 | + |
| 56 | + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<<<TWIG |
| 57 | + <section class="accordion-item" aria-label="a label"> |
| 58 | + <h2 class="accordion-header" id="example-heading" title="example-heading-id" data-bs-toggle="tooltip"> |
| 59 | + <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#example-pre-content" aria-expanded="true" aria-controls="example-pre-content"> |
| 60 | + <i class="ti ti-world me-1"></i> |
| 61 | + <span class="item-title"> |
| 62 | + Example pre section |
| 63 | + </span> |
| 64 | + </button> |
| 65 | + </h2> |
| 66 | + <div id="example-pre-content" class="accordion-collapse collapse" aria-labelledby="example-pre-content-heading"> |
| 67 | + <div class="accordion-body"> |
| 68 | + Example pre section |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + </section> |
| 72 | +TWIG, []); |
| 73 | + |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Display contents at the end of ITILObject section (right panel). |
| 78 | + * |
| 79 | + * @param array $params Array with "item" and "options" keys |
| 80 | + * |
| 81 | + * @return void |
| 82 | + */ |
| 83 | + static public function postSection($params) { |
| 84 | + $item = $params['item']; |
| 85 | + $options = $params['options']; |
| 86 | + |
| 87 | + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<<<TWIG |
| 88 | + <section class="accordion-item" aria-label="a label"> |
| 89 | + <h2 class="accordion-header" id="example-heading" title="example-heading-id" data-bs-toggle="tooltip"> |
| 90 | + <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#example-post-content" aria-expanded="true" aria-controls="example-post-content"> |
| 91 | + <i class="ti ti-world me-1"></i> |
| 92 | + <span class="item-title"> |
| 93 | + Example post section |
| 94 | + </span> |
| 95 | + </button> |
| 96 | + </h2> |
| 97 | + <div id="example-post-content" class="accordion-collapse collapse" aria-labelledby="example-post-content-heading"> |
| 98 | + <div class="accordion-body"> |
| 99 | + Example post section |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + </section> |
| 103 | +TWIG, []); |
| 104 | + } |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
42 | 110 | /** |
43 | 111 | * Display contents at the begining of item forms. |
44 | 112 | * |
|
0 commit comments