<?php
/**
 * Copyright © Magefan (support@magefan.com). All rights reserved.
 * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
 *
 * Glory to Ukraine! Glory to the heroes!
 */
?>
<?php
/**
 * Product related posts template
 *
 * @var $block \Magefan\Blog\Block\Catalog\Product\RelatedPosts
 */
?>

<?php if ($block->displayPosts()) { ?>
    <?php $_postCollection = $block->getPostCollection(); ?>
    <?php if ($_postCollection->count()) { ?>
    <div class="block related">
        <?php if ($block->getShowTitle()) { ?>
        <div class="block-title title">
            <strong id="block-relatedposts-heading" role="heading" aria-level="2">
                <?= $block->escapeHtml(__('Related posts')) ?>
            </strong>
        </div>
        <?php } ?>

        <ol class="block-content">
            <?php foreach ($_postCollection as $_post) { ?>
                <li class="item">
                    <a class="post-item-link"
                       href="<?= $block->escapeUrl($_post->getPostUrl()) ?>">
                        <?= $block->escapeHtml($_post->getTitle()); ?>
                    </a>
                </li>
            <?php } ?>
        </ol>
    </div>
    <?php } ?>
<?php } ?>