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

<!-- Display a single article object -->
<?php if ($content): ?>

<!-- Title and meta information -->
<div>
  <h2 class="title"><?php echo $content->icon; ?> <?php echo $content->escapeForXss('title'); ?></h2>
  <?php if ($contentInfo): ?>
  <p class="content-info">
    <span class="small">
    <?php if (TfSession::isAdmin()): ?>
    <a href="<?php echo TFISH_ADMIN_URL . 'admin.php?op=edit&amp;id=' . $content->escapeForXss('id'); ?>"><i title="<?php echo TFISH_EDIT_CONTENT; ?>" class="fas fa-edit"></i></a>
    <?php endif; ?>
    <?php echo $contentInfo; ?>
    </span>
  </p>
  <?php endif; ?>
</div>

<!-- Image -->
<?php if ($content->image): ?>
<div>
  <figure class="figure-centre">
    <img class="image img-fluid" src="<?php echo $content->getCachedImage(1170); ?>" 
      <?php if ($content->caption): ?>
          title="<?php echo $content->escapeForXss('caption'); ?>" alt="<?php echo $content->escapeForXss('caption'); ?>"/>
        <figcaption class="text-left"><em><?php echo $content->escapeForXss('caption'); ?></em></figcaption>
      <?php else: ?>
          alt="" />
      <?php endif; ?>
  </figure>
</div>
<?php endif; ?>

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

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

<!-- Rights -->
<?php if ($content->rights): ?>
<div>
  <p class="rights"><?php echo $content->escapeForXss('rights'); ?></p>
</div>
<?php endif; ?>

<!-- Display parent work -->
<?php if (!empty($parent)): ?>
<div>
  <h3><?php echo TFISH_RELATED; ?></h3>
  <h4 class="parent"><a href="<?php echo $parent->getUrl($targetFileName); ?>"><?php echo $parent->icon; ?> <?php echo $parent->escapeForXss('title'); ?></a></h4>
  <?php if ($parent->image): ?>
  <div class="float-left">
    <figure class="figure-left">
    <a href="<?php echo $parent->getUrl($targetFileName); ?>">
    <img class="image img-fluid" src="<?php echo $parent->getCachedImage(150); ?>" 
    <?php if ($parent->caption): ?>
        title="<?php echo $parent->escapeForXss('caption'); ?>" alt="<?php echo $parent->escapeForXss('caption'); ?>"
    <?php else: ?>
        alt=""
    <?php endif; ?>
    /></a>
    </figure>
    </div>
  <?php endif; ?>
  <div class="teaser"><?php echo $parent->escapeForXss('teaser'); ?></div>
</div>
<?php endif; ?>
<?php endif; ?>