<?php declare(strict_types=1); ?>

<!-- Title and meta information -->
<div>
  <h2 class="title">
    <?php if ($content->media()): ?>
    <a href="<?php echo TFISH_URL . 'enclosure/?id=' . xss($content->id()); ?>"><?php echo xss($content->title()); ?></a>
    <?php else: ?>
    <?php echo xss($content->title()); ?>
    <?php endif; ?>
  </h2>

  <p class="content-info">
    <span class="small">
      <?php echo xss($content->date()
        ->format($viewModel->dateFormat())) . ' | '; ?>
      <?php echo xss($content->info()); ?>
      <?php if ($contentTags) {
          echo ' | ';
          $tags = [];
          foreach ($contentTags as $key => $value) {
            $tags[] = '<a href="?id=' . xss($key) . '">' . xss($value) . '</a>';
          }
          echo \implode(', ', $tags);
        } ?>
    </span>
  </p>
</div>

<?php if ($content->media()): ?>
<div class="video-player text-left">
  <video controls>
    <source src="<?php echo TFISH_MEDIA_URL . xss($content->media()); ?>" type="<?php echo xss($content->format()); ?>">
        <?php echo TFISH_BROWSER_DOES_NOT_SUPPORT_VIDEO; ?>
  </video>
</div>
<?php endif; ?>

<!-- Description -->
<div class="description">
  <?php if ($content->description()) echo $content->descriptionForDisplay(); ?>
</div>

<!-- Media attachment -->
<?php if ($content->media()): ?>
<div>
  <p class="media"><b><a href="<?php echo TFISH_URL . 'enclosure/?id=' . xss($content->id()); ?>"><i title="<?php echo TFISH_DOWNLOAD; ?>" class="fas fa-download"></i> <?php echo xss($content->media()); ?></a></b></p>
</div>
<?php endif; ?>

<!-- Rights -->
<?php if ($content->rights()): ?>
<div>
  <p class="rights"><?php echo xss($content->listRights()[$content->rights()]); ?></p>
</div>
<?php endif; ?>

<?php if (!empty($parent)) include_once('parent.html'); ?>
