diff --git a/src/DataTables/AttachmentDataTable.php b/src/DataTables/AttachmentDataTable.php index 459e63bd..0d1f02a0 100644 --- a/src/DataTables/AttachmentDataTable.php +++ b/src/DataTables/AttachmentDataTable.php @@ -83,12 +83,19 @@ final class AttachmentDataTable implements DataTableTypeInterface if ($context->isPicture() && ! $context->isExternal() && $this->attachmentHelper->isFileExisting($context)) { + + $title = htmlspecialchars($context->getName()); + if ($context->getFilename()) { + $title .= ' (' . htmlspecialchars($context->getFilename()) . ')'; + } + return sprintf( - '%s', + '%s', 'Part image', $this->attachmentURLGenerator->getThumbnailURL($context), $this->attachmentURLGenerator->getThumbnailURL($context, 'thumbnail_md'), - 'img-fluid hoverpic' + 'img-fluid hoverpic', + $title ); } diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 67329bab..7c79683d 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -161,12 +161,18 @@ final class PartsDataTable implements DataTableTypeInterface return ''; } + $title = htmlspecialchars($preview_attachment->getName()); + if ($preview_attachment->getFilename()) { + $title .= ' (' . htmlspecialchars($preview_attachment->getFilename()) . ')'; + } + return sprintf( - '%s', + '%s', 'Part image', $this->attachmentURLGenerator->getThumbnailURL($preview_attachment), $this->attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_md'), - 'img-fluid hoverpic' + 'img-fluid hoverpic', + $title ); }, ])