Move template to content/

This commit is contained in:
Michael 2021-04-05 11:44:43 +00:00
parent 7e0d21b5bb
commit e8a539b68d
2 changed files with 12 additions and 6 deletions

View file

@ -2676,7 +2676,8 @@ class Item
*/ */
private static function addMediaAttachments(array $item, string $content) 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) { foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
$mime = $attachment['mimetype']; $mime = $attachment['mimetype'];
@ -2694,7 +2695,8 @@ class Item
} }
if (($filetype == 'video')) { 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' => [ '$video' => [
'id' => $item['author-id'], 'id' => $item['author-id'],
'src' => $the_url, 'src' => $the_url,
@ -2702,7 +2704,7 @@ class Item
], ],
]); ]);
} elseif ($filetype == 'audio') { } elseif ($filetype == 'audio') {
$attached .= Renderer::replaceMacros(Renderer::getMarkupTemplate('audio.tpl'), [ $leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/audio.tpl'), [
'$audio' => [ '$audio' => [
'id' => $item['author-id'], 'id' => $item['author-id'],
'src' => $the_url, 'src' => $the_url,
@ -2718,12 +2720,16 @@ class Item
/// @todo Use a template /// @todo Use a template
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>'; $icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
$attached .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" rel="noopener noreferrer" >' . $icon . '</a>'; $trailing .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" rel="noopener noreferrer" >' . $icon . '</a>';
} }
} }
if ($attached != '') { if ($leading != '') {
$content .= '<div class="body-attach">' . $attached . '<div class="clear"></div></div>'; $content = '<div class="body-attach">' . $leading . '<div class="clear"></div></div>' . $content;
}
if ($trailing != '') {
$content .= '<div class="body-attach">' . $trailing . '<div class="clear"></div></div>';
} }
return $content; return $content;