Skip to content

Commit

Permalink
IncidentDetail: Don't render Object Tags section if no tags are ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
sukhwinder33445 committed Jan 29, 2025
1 parent ede7734 commit dc4cb4d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions library/Notifications/Widget/Detail/IncidentDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,22 @@ protected function createSource()
];
}

protected function createObjectTag()
protected function createObjectTag(): array
{
$objectTags = (new Table())->addAttributes(['class' => 'object-tags-table']);

$tags = [];
foreach ($this->incident->object->object_extra_tag as $extraTag) {
$objectTags->addHtml(Table::row([$extraTag->tag, $extraTag->value]));
$tags[] = Table::row([$extraTag->tag, $extraTag->value]);
}

if (empty($tags)) {
return $tags;
}

return [
Html::tag('h2', t('Object Tags')),
$objectTags
new HtmlElement('h2', null, new Text(t('Object Tags'))),
(new Table())
->addHtml(...$tags)
->addAttributes(['class' => 'object-tags-table'])
];
}

Expand Down

0 comments on commit dc4cb4d

Please sign in to comment.