[AttachmentToNote][Attachment] Add title getter to Attachment

This commit is contained in:
2021-08-12 03:43:11 +01:00
committed by Hugo Sales
parent 5fd91bf3a2
commit d076781c74
8 changed files with 50 additions and 8 deletions

View File

@@ -126,7 +126,11 @@ class ImageEncoder extends Plugin
*/
public function onViewAttachmentImage(array $vars, array &$res): bool
{
$res[] = Formatting::twigRenderFile('imageEncoder/imageEncoderView.html.twig', ['attachment' => $vars['attachment'], 'thumbnail_parameters' => $vars['thumbnail_parameters']]);
$res[] = Formatting::twigRenderFile('imageEncoder/imageEncoderView.html.twig',
['attachment' => $vars['attachment'],
'thumbnail_parameters' => $vars['thumbnail_parameters'],
'note' => $vars['note'],
]);
return Event::stop;
}

View File

@@ -2,6 +2,6 @@
<img class="u-photo" src="{{ path('attachment_thumbnail', thumbnail_parameters) }}"
alt="{{ attachment.getFilename() }}">
<figcaption><a
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getFilename() }}</a>
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
</figcaption>
</figure>