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 (#286)

resolves #270
  • Loading branch information
sukhwinder33445 authored Feb 26, 2025
2 parents 590a1c3 + 43d81c6 commit fb6b06c
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 (! $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 fb6b06c

Please sign in to comment.