diff --git a/src/Model/Item.php b/src/Model/Item.php index 765812b9f..76402280c 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2676,7 +2676,8 @@ class Item */ private static function addMediaAttachments(array $item, string $content) { - $attached = ''; + $leading = ''; + $trailing = ''; foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) { $mime = $attachment['mimetype']; @@ -2694,7 +2695,8 @@ class Item } if (($filetype == 'video')) { - $attached .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [ + /// @todo Move the template to /content as well + $leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [ '$video' => [ 'id' => $item['author-id'], 'src' => $the_url, @@ -2702,7 +2704,7 @@ class Item ], ]); } elseif ($filetype == 'audio') { - $attached .= Renderer::replaceMacros(Renderer::getMarkupTemplate('audio.tpl'), [ + $leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/audio.tpl'), [ '$audio' => [ 'id' => $item['author-id'], 'src' => $the_url, @@ -2718,12 +2720,16 @@ class Item /// @todo Use a template $icon = '
'; - $attached .= '' . $icon . ''; + $trailing .= '' . $icon . ''; } } - if ($attached != '') { - $content .= '
' . $attached . '
'; + if ($leading != '') { + $content = '
' . $leading . '
' . $content; + } + + if ($trailing != '') { + $content .= '
' . $trailing . '
'; } return $content; diff --git a/view/templates/audio.tpl b/view/templates/content/audio.tpl similarity index 100% rename from view/templates/audio.tpl rename to view/templates/content/audio.tpl