Show attachment name and filename when hovering over an table picture.

This commit is contained in:
Jan Böhmer 2020-05-27 21:54:08 +02:00
parent 53dd0c4228
commit 19e132c746
2 changed files with 17 additions and 4 deletions

View file

@ -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(
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s">',
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s" data-title="%s">',
'Part image',
$this->attachmentURLGenerator->getThumbnailURL($context),
$this->attachmentURLGenerator->getThumbnailURL($context, 'thumbnail_md'),
'img-fluid hoverpic'
'img-fluid hoverpic',
$title
);
}