<?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
/**
 * Blog related posts template
 *
 * @var $block \Magefan\Blog\Block\Post\View\RelatedPosts
 * @var $block \Magefan\Blog\Block\Catalog\Product\RelatedPosts
 */
?>

<?php if ($block->displayPosts()) { ?>
    <?php $postCollection = $block->getPostCollection(); ?>
    <?php if (count($postCollection)) { ?>
    <div class="mfblog-related-posts-block block related">
        <?php if (!$block->getHideTitle()) { ?>
        <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" title="<?= $block->escapeHtml($post->getTitle()) ?>"
                       href="<?= $block->escapeUrl($post->getPostUrl()) ?>">
                        <?= $block->escapeHtml($post->getTitle()) ?>
                    </a>
                </li>
            <?php } ?>
        </ol>
    </div>
    <?php } ?>
<?php } ?>

