From 56c61570138acb7dbb8197a79db9b3893e7e5322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 29 Nov 2022 00:10:40 +0100 Subject: [PATCH] Show icon before part name in Parts table to mark if a part has favorite or needs review status --- src/DataTables/PartsDataTable.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 46ad8cf7..c260762c 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -150,10 +150,22 @@ final class PartsDataTable implements DataTableTypeInterface ->add('name', TextColumn::class, [ 'label' => $this->translator->trans('part.table.name'), 'render' => function ($value, Part $context) { + $icon = ''; + + //Depending on the part status we show a different icon (the later conditions have higher priority) + if ($context->isFavorite()) { + $icon = sprintf('', $this->translator->trans('part.favorite.badge')); + } + if ($context->isNeedsReview()) { + $icon = sprintf('', $this->translator->trans('part.needs_review.badge')); + } + + return sprintf( - '%s', + '%s%s', $this->urlGenerator->infoURL($context), - $context->getName() + $icon, + htmlentities($context->getName()) ); }, ])