Skip to content

Commit 03c873e

Browse files
Add missing icons for template view
1 parent 5c246ae commit 03c873e

7 files changed

+29
-3
lines changed

phpunit/functional/ITILTemplateTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ public function testGetTabNameForItem($itiltype)
319319
$expected = [
320320
1 => 'Preview',
321321
];
322-
$this->assertSame($expected, $tpl->getTabNameForItem($tpl));
322+
$this->assertSame(
323+
$expected,
324+
array_map('strip_tags', $tpl->getTabNameForItem($tpl)),
325+
);
323326
}
324327

325328
#[DataProvider('itilProvider')]

src/ITILCategory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
417417
{
418418
if (Session::haveRight(self::$rightname, READ)) {
419419
if ($item instanceof ITILTemplate) {
420-
$ong[1] = $this::getTypeName(Session::getPluralNumber());
420+
$ong[1] = static::createTabEntry(
421+
$this::getTypeName(Session::getPluralNumber()),
422+
icon: static::getIcon(),
423+
);
421424
return $ong;
422425
}
423426
}

src/ITILTemplate.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
437437
case 'TicketTemplate':
438438
case 'ChangeTemplate':
439439
case 'ProblemTemplate':
440-
return [1 => __('Preview')];
440+
return [1 => static::createTabEntry(
441+
__('Preview'),
442+
icon: "ti ti-file-search"
443+
)];
441444
}
442445
}
443446
return '';

src/ITILTemplateHiddenField.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public static function getTypeName($nb = 0)
4848
return _n('Hidden field', 'Hidden fields', $nb);
4949
}
5050

51+
public static function getIcon(): string
52+
{
53+
return 'ti ti-eye-off';
54+
}
5155

5256
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
5357
{

src/ITILTemplateMandatoryField.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public static function getTypeName($nb = 0)
4747
return _n('Mandatory field', 'Mandatory fields', $nb);
4848
}
4949

50+
public static function getIcon(): string
51+
{
52+
return 'ti ti-asterisk';
53+
}
54+
5055

5156
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
5257
{

src/ITILTemplatePredefinedField.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public static function getTypeName($nb = 0)
4848
return _n('Predefined field', 'Predefined fields', $nb);
4949
}
5050

51+
public static function getIcon(): string
52+
{
53+
return 'ti ti-forms';
54+
}
5155

5256
protected function computeFriendlyName()
5357
{

src/ITILTemplateReadonlyField.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public static function getTypeName($nb = 0)
4848
return _n('Read only field', 'Read only fields', $nb);
4949
}
5050

51+
public static function getIcon(): string
52+
{
53+
return 'ti ti-lock';
54+
}
5155

5256
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
5357
{

0 commit comments

Comments
 (0)