Skip to content

Commit ea7e141

Browse files
authored
Merge pull request #409 from magefan/6096-fix-add-this
Fixed AddThis and CSS changes
2 parents 89c7dab + 907640f commit ea7e141

File tree

4 files changed

+46
-26
lines changed

4 files changed

+46
-26
lines changed

Block/Post/AbstractPost.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,19 @@ public function getStyleViewModel()
232232

233233
return $viewModel;
234234
}
235+
236+
/**
237+
* Check if AddThis Enabled and key exist
238+
*
239+
* @return bool
240+
*/
241+
public function displayAddThisToolbox()
242+
{
243+
$isSocialEnabled = $this->_scopeConfig->getValue(
244+
'mfblog/social/add_this_enabled', ScopeInterface::SCOPE_STORE);
245+
$isSocialIdExist = $this->_scopeConfig->getValue(
246+
'mfblog/social/add_this_pubid', ScopeInterface::SCOPE_STORE);
247+
248+
return $isSocialEnabled && $isSocialIdExist;
249+
}
235250
}

view/frontend/templates/post/list/item.phtml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Blog post list item template
1212
*
13-
* @var $block \Magefan\Blog\Block\Post\AbstractPost
13+
* @var $block \Magefan\Blog\Block\Post\PostList\Item
1414
*/
1515
?>
1616
<?php
@@ -21,25 +21,28 @@ $_postName = $block->escapeHtml($_post->getTitle());
2121
<li class="post-holder post-holder-<?= (int)$_post->getId() ?>">
2222
<div class="post-header">
2323

24-
<div class="post-title-holder clearfix">
24+
<div class="post-title-holder">
2525
<h2 class="post-title">
2626
<a class="post-item-link"
2727
href="<?= /*@noEscape*/ $_postUrl ?>">
2828
<?= /*@noEscape*/ $_postName ?>
2929
</a>
3030
</h2>
3131

32-
<div class="addthis_toolbox addthis_default_style"
33-
addthis:url="<?= /*@noEscape*/ $_postUrl ?>"
34-
addthis:title="<?= /*@noEscape*/ $_postName ?>"
35-
<?php if ($firstImage = $_post->getFirstImage()) { ?>
36-
addthis:media="<?= $block->escapeHtml($firstImage) ?>"
37-
<?php } ?>>
38-
<a class="addthis_button_facebook"></a>
39-
<a class="addthis_button_twitter"></a>
40-
<a class="addthis_button_email"></a>
41-
<a class="addthis_button_compact"></a>
42-
</div>
32+
<?php if ($block->displayAddThisToolbox()) : ?>
33+
<div class="addthis_toolbox addthis_default_style"
34+
addthis:url="<?= /*@noEscape*/ $_postUrl ?>"
35+
addthis:title="<?= /*@noEscape*/ $_postName ?>"
36+
<?php if ($firstImage = $_post->getFirstImage()) { ?>
37+
addthis:media="<?= $block->escapeHtml($firstImage) ?>"
38+
<?php } ?>>
39+
<a class="addthis_button_facebook"></a>
40+
<a class="addthis_button_twitter"></a>
41+
<a class="addthis_button_email"></a>
42+
<a class="addthis_button_compact"></a>
43+
</div>
44+
<?php endif; ?>
45+
4346
</div>
4447

4548
<?= /*@noEscape*/ $block->getInfoHtml() ?>

view/frontend/templates/post/view.phtml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ $_postName = $block->escapeHtml($_post->getTitle(), null);
2020
?>
2121
<div class="post-view">
2222
<div class="post-holder post-holder-<?= (int)$_post->getId() ?>">
23-
<div class="post-header clearfix">
24-
<div class="addthis_toolbox addthis_default_style" addthis:url="<?= $block->escapeUrl($_postUrl) ?>">
25-
<a class="addthis_button_facebook"></a>
26-
<a class="addthis_button_twitter"></a>
27-
<a class="addthis_button_email"></a>
28-
<a class="addthis_button_compact"></a>
29-
</div>
30-
<?= $block->getInfoHtml() ?>
31-
</div>
23+
24+
<?php if ($block->displayAddThisToolbox()) : ?>
25+
<div class="post-header">
26+
<div class="addthis_toolbox addthis_default_style" addthis:url="<?= $block->escapeUrl($_postUrl) ?>">
27+
<a class="addthis_button_facebook"></a>
28+
<a class="addthis_button_twitter"></a>
29+
<a class="addthis_button_email"></a>
30+
<a class="addthis_button_compact"></a>
31+
</div>
32+
<?= $block->getInfoHtml() ?>
33+
</div>
34+
<?php endif; ?>
3235

3336
<div class="post-content">
3437
<div class="post-description clearfix">

view/frontend/web/css/blog-m.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@
4747
.post-content .post-description .post-ftimg-hld img {width:100%; padding:0; margin:0;}
4848

4949
/* Post Title */
50-
.post-list .post-header .post-title-holder:before {content: "";display: table;}
51-
.post-list .post-header .post-title-holder:after {content: "";display: table;clear: both;}
52-
.post-list .post-header .post-title {max-width:80%;margin: 0;padding: 10px 0;}
50+
.post-list .post-header .post-title-holder {display: flex;align-items: center;justify-content: space-between;flex-wrap: wrap;}
51+
.post-list .post-header .post-title {margin: 0;padding: 10px 0;}
5352
.post-list .post-header .post-title a {text-decoration: none;font-size: 22px;font-weight: 400;}
54-
.post-list .post-holder .post-header .addthis_toolbox {float: right; padding-top: 20px;}
53+
.post-list .post-holder .post-header .addthis_toolbox a {margin-bottom: 0;}
5554

5655
.post-list .hidden {display:none;}
5756
.post-view .post-bottom {margin-top:30px;}

0 commit comments

Comments
 (0)