-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathview-modern.phtml
169 lines (155 loc) · 8.14 KB
/
view-modern.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
/**
* Copyright © Magefan ([email protected]). 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 view template
*
* @var $block \Magefan\Blog\Block\Post\View
*/
?>
<?php
$_post = $block->getPost();
$_postUrl = $_post->getPostUrl();
$_postImage = $_post->getOgImage()? $_post->getOgImage() : $_post->getFeaturedImage();
$_postName = $block->escapeHtml($_post->getTitle(), null);
?>
<?= $block->getStyleViewModel()->getStyle('Magefan_Blog::css/bootstrap-4.4.1-custom-min.css') ?>
<div class="_post-view post-view-modern">
<div class="post-holder post-holder-<?= (int)$_post->getId() ?>">
<div class="post-header clearfix">
<!-- post category-->
<?php if ($_categoriesCount = $_post->getCategoriesCount()) { ?>
<div class="post-category mb-4">
<?php foreach ($_post->getParentCategories() as $ct) { ?>
<a class="category-name" href="<?= $block->escapeUrl($ct->getCategoryUrl()) ?>"
title="<?= $block->escapeHtml($ct->getTitle()) ?>">
<?= $block->escapeHtml($ct->getTitle()) ?>
</a>
<?php } ?>
</div>
<?php } ?>
<!-- block data -->
<div class="post-data-wrap mb-4">
<!-- post author -->
<?php if ($block->authorEnabled()) { ?>
<?php if ($_author = $_post->getAuthor()) { ?>
<span class="post-author-name">
<?php if ($block->authorPageEnabled()) { ?>
<a title="<?= $block->escapeHtml($_author->getTitle()) ?>"
href="<?= $block->escapeUrl($_author->getAuthorUrl()) ?>"><?= $block->escapeHtml($_author->getTitle()) ?>
</a>
<?php } else { ?>
<?= $block->escapeHtml($_author->getTitle()) ?>
<?php } ?>
<?php
$coAuthors = $_post->getRelatedCoauthors();
$coAuthorsCount = count($coAuthors);
?>
<?php if ($coAuthorsCount) { ?>
<?= $block->escapeHtml(__('and')) ?>
<?php $z = 0 ?>
<?php foreach($coAuthors as $coAuthor) { ?>
<?php $z++; ?>
<?php if ($block->authorPageEnabled()) { ?>
<a title="<?= $block->escapeHtml($coAuthor->getTitle()) ?>"
href="<?= $block->escapeUrl($coAuthor->getAuthorUrl()) ?>"><?= $block->escapeHtml($coAuthor->getTitle()) ?></a><?php if ($z != $coAuthorsCount) echo ', ' ?>
<?php } else { ?>
<?= $block->escapeHtml($coAuthor->getTitle()) ?><?php if ($z != $coAuthorsCount) echo ', ' ?>
<?php } ?>
<?php } ?>
<?php } ?>
</span>
<?php } ?>
<?php } ?>
<!-- post date -->
<?php if ($_post->isPublishDateEnabled()) { ?>
<span class="post-date"><span>-</span> <?= $block->escapeHtml($_post->getPublishDate()) ?></span>
<?php } ?>
<!-- reading time -->
<?php if ($block->readingTimeEnabled() && $_post->getReadingTime()) { ?>
<span class="reading-time"><?= ' - ' . $block->escapeHtml($_post->getReadingTime()) . ' ' . __('min read') ?></span>
<?php } ?>
<!-- post views -->
<?php if ($block->viewsCountEnabled()) { ?>
<?php if ($viewsCount = $_post->getViewsCount()) { ?>
<span class="post-views float-right d-none d-md-block">
<i class="mf-blog-icon mfbi-views"></i>
<?= $block->escapeHtml($viewsCount)?>
</span>
<?php } ?>
<?php } ?>
<!-- post comments -->
<?php if ($block->magefanCommentsEnabled() && $_post->getCommentsCount()) { ?>
<span class="post-comments float-right d-none d-md-block">
<i class="mf-blog-icon mfbi-comments"></i>
<a title="<?= $block->escapeHtml($_post->getTitle()) ?>"
href="<?= $block->escapeUrl($_post->getPostUrl()) ?>#post-comments"
><?= $block->escapeHtml($_post->getCommentsCount()) ?></a>
</span>
<?php } ?>
</div>
</div>
<div class="post-content">
<div class="_post-description clearfix">
<!-- Post Image -->
<?php if ($featuredImage = $_post->getFeaturedImage()) { ?>
<?php
$featuredImgAlt = $_post->getData('featured_img_alt');
if (!$featuredImgAlt) {
$featuredImgAlt = $_postName;
}
?>
<div class="post-featured-image">
<img src="<?= $block->escapeUrl($featuredImage) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
</div>
<?php } ?>
<!-- Post Tags -->
<?php if ($_tagsCount = $_post->getTagsCount()) { ?>
<div class="post-tag">
<div class="item post-tags">
<div class="post-tag-title"><?= $block->escapeHtml(__('Tags')) ?></div>
<?php $n = 0; ?>
<?php foreach ($_post->getRelatedTags() as $tag) { ?>
<?php $n++; ?>
<a title="<?= $block->escapeHtml($tag->getTitle()) ?>"
href="<?= $block->escapeUrl($tag->getTagUrl()) ?>"
><?= $block->escapeHtml($tag->getTitle()) ?></a>
<?php } ?>
</div>
</div>
<?php } ?>
<!-- END Post Tags -->
<div class="post-description">
<?= /*@noEscape*/ $block->getContent() ?>
<div class="clear clearfix"></div>
</div>
</div>
</div>
<div class="post-bottom">
<?php if ($block->displayAddThisToolbox()) : ?>
<!-- Post Sharing -->
<div class="post-sharing post-sharing-bottom">
<div class="share-elements">
<?php foreach ($block->getAllowedSocialNetworks() as $network) { ?>
<div class="icon-wrapper icon-<?= strtolower($network) ?>" onclick="mfShareWindowOpen('<?= $block->escapeUrl($_postUrl) ?>', '<?= strtolower($network) ?>', '<?= $_postImage ?>')">
<div class="icon" title="<?= $block->escapeHtml(__('Share on %1', $network == 'Twitter' ? "X" : $network)) ?>">
<img src="<?= $this->getViewFileUrl('Magefan_Blog::images/social/' . strtolower($network) . '.svg') ?>" alt="<?= $block->escapeHtml(__('Share on %1', $network == 'Twitter' ? "X" : $network)) ?>">
</div>
<div class="label"><?= $block->escapeHtml(__('Share on %1', $network == 'Twitter' ? "X" : $network)) ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- END Post Sharing -->
<?php endif; ?>
<?= $block->getChildHtml('blog.post.bottom') ?>
</div>
</div>
</div>