Show mount names as comma separated tags

This commit is contained in:
Jan Böhmer 2022-12-23 12:38:49 +01:00
parent b074095038
commit b1ed52bcc3
3 changed files with 20 additions and 2 deletions

View file

@ -76,7 +76,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
])
->add('quantity', TextColumn::class, [
'label' => $this->translator->trans('project.bom.quantity'),
'label' => $this->translator->trans('project.bom.quantity'),
'className' => 'text-center',
'render' => function ($value, ProjectBOMEntry $context) {
//If we have a non-part entry, only show the rounded quantity
@ -132,7 +132,15 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
])
->add('mountnames', TextColumn::class, [
'label' => 'project.bom.mountnames',
'render' => function ($value, ProjectBOMEntry $context) {
$html = '';
foreach (explode(',', $context->getMountnames()) as $mountname) {
$html .= sprintf('<span class="badge badge-secondary bg-secondary">%s</span> ', htmlspecialchars($mountname));
}
return $html;
},
])