<?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 post list item template
 *
 * @var $block \Magefan\Blog\Block\Post\AbstractPost
 */
?>
<?php
    $_post = $block->getPost();
    $_postUrl = $block->escapeUrl($_post->getPostUrl());
    $_postName = $block->escapeHtml($_post->getTitle());
	$featuredImage = $_post->getFeaturedListImage() ?: $_post->getFeaturedImage();
?>
<li class="item-post-full post-holder post-holder-<?= (int)$_post->getId() ?> <?php if ($featuredImage) { ?>has-thumb<?php } ?>">
	<div class="post-item">
		<div class="blog-post-thumb">
			<?php if ($featuredImage) { ?>
				<?php
					$featuredImgAlt = $_post->getData('featured_list_img_alt') ?: $_post->getData('featured_img_alt');
				if (!$featuredImgAlt) {
					$featuredImgAlt = $_postName;
				}
				?>
				<div class="post-ftimg-hld">
					<a href="<?= /*@noEscape*/ $_postUrl ?>" title="<?= /*@noEscape*/ $_postName ?>">
						<img src="<?= $block->escapeUrl($featuredImage) ?>"
							 alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
					</a>
				</div>
			<?php } ?>
		</div>
		<div class="blog-post-info">
			<div class="post-header">
				<div class="post-title-holder clearfix">
					<h2 class="post-title">
						<a class="post-item-link"
						   href="<?= /*@noEscape*/ $_postUrl ?>">
							<?= /*@noEscape*/ $_postName ?>
						</a>
					</h2>
				</div>
				<?= /*@noEscape*/ $block->getInfoHtml() ?>
			</div>
			<?php if ($_categoriesCount = $_post->getCategoriesCount()) { ?>
				<div class="item post-categories">
					<?php $n = 0; ?>
					<?php foreach ($_post->getParentCategories() as $ct) { ?>
						<?php $n++; ?>
						<a title="<?= $block->escapeHtml($ct->getTitle()) ?>"
						   href="<?= $block->escapeUrl($ct->getCategoryUrl()) ?>"
						><?= $block->escapeHtml($ct->getTitle()) ?></a><?= /*@noEscape*/ ($n != $_categoriesCount) ? ',' : '' ?>
					<?php } ?>
				</div>
			<?php } ?>
			<div class="post-content">
				<div class="post-description clearfix">
					<div class="post-text-hld clearfix">
						<?= /*@noEscape*/ $block->getShorContent() ?>
					</div>
				</div>
			</div>
			<div class="post-bottom">
				<div class="flex-layout space-between no-wrap">
					<a class="post-read-more"
					   href="<?= /*@noEscape*/ $_postUrl ?>"
					   title="<?= /*@noEscape*/ $_postName ?>"
					   >
						<?= $block->escapeHtml(__('Read more')) ?>
					</a>
					<?php if ($_post->isPublishDateEnabled()) { ?>
						<div class="item post-posed-date">
							<span class="label"><?= $block->escapeHtml(__('Posted:')) ?></span>
							<span class="value"><?= $block->escapeHtml($_post->getPublishDate()) ?></span>
						</div>
					<?php } ?>
				</div>
			</div>
		</div>
	</div>
</li>