File tree Expand file tree Collapse file tree 8 files changed +55
-32
lines changed Expand file tree Collapse file tree 8 files changed +55
-32
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Magefan \Blog \Block \Social ;
4+
5+ use Magento \Store \Model \ScopeInterface ;
6+
7+ class AddThis extends \Magento \Framework \View \Element \Template
8+ {
9+ public function getAddThisPubId ()
10+ {
11+ return $ this ->_scopeConfig ->getValue (
12+ 'mfblog/social/add_this_pubid ' , ScopeInterface::SCOPE_STORE
13+ );
14+ }
15+
16+ public function getAddThisLanguage ()
17+ {
18+ return $ this ->_scopeConfig ->getValue (
19+ 'mfblog/social/add_this_language ' , ScopeInterface::SCOPE_STORE
20+ );
21+ }
22+
23+ public function toHtml ()
24+ {
25+ if (!$ this ->getAddThisPubId ()) {
26+ return '' ;
27+ }
28+
29+ return parent ::toHtml ();
30+ }
31+ }
Original file line number Diff line number Diff line change 266266 <comment >E.g.: "search" will make the blog search accessible from mystore.com/{blog_route}/search/query/</comment >
267267 </field >
268268 </group >
269+ <group id =" social" translate =" label" type =" text" sortOrder =" 80" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
270+ <label >Social</label >
271+ <field id =" add_this_pubid" type =" text" translate =" label" sortOrder =" 10" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
272+ <label >AddThis ID</label >
273+ </field >
274+ <field id =" add_this_language" type =" text" translate =" label" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
275+ <label >AddThis Language</label >
276+ </field >
277+ </group >
269278 </section >
270279 </system >
271280</config >
Original file line number Diff line number Diff line change 7171 <author_route >author</author_route >
7272 <search_route >search</search_route >
7373 </permalink >
74+ <social >
75+ <add_this_pubid >ra-4def63cd3cf37569</add_this_pubid >
76+ <add_this_language >en</add_this_language >
77+ </social >
7478 </mfblog >
7579 </default >
7680</config >
Original file line number Diff line number Diff line change 3030 <action method =" setToolbarBlockName" >
3131 <argument name =" name" xsi : type =" string" >post_list_toolbar</argument >
3232 </action >
33+
34+ <block class =" Magefan\Blog\Block\Social\AddThis" name =" addthis.js.init" as =" addthisJs" template =" Magefan_Blog::addthis-js.phtml" />
3335 </referenceBlock >
3436 </body >
3537</page >
Original file line number Diff line number Diff line change 2121 <block class =" Magefan\Blog\Block\Post\View\RelatedPosts" name =" blog.post.relatedposts" as =" relatedposts" template =" Magefan_Blog::post/view/relatedposts.phtml" />
2222 <block class =" Magefan\Blog\Block\Post\View\RelatedProducts" name =" blog.post.relatedproducts" as =" relatedproducts" template =" Magefan_Blog::post/view/relatedproducts.phtml" />
2323 <block class =" Magefan\Blog\Block\Post\View\Comments" name =" blog.post.comments" template =" post/view/comments.phtml" />
24- <block class =" Magento\Framework\View\Element\Template " name =" blog.post.js " as =" js " template =" Magefan_Blog::post/view/ js.phtml" />
24+ <block class =" Magefan\Blog\Block\Social\AddThis " name =" addthis.js.init " as =" addthisJs " template =" Magefan_Blog::addthis- js.phtml" />
2525 </block >
2626 </block >
2727 </referenceContainer >
Original file line number Diff line number Diff line change 1+ <script type="text/javascript">
2+ var addthis_config = {
3+ "ui_language": '<?php echo $ this ->getAddThisLanguage (); ?> ',
4+ "data_track_clickback":false
5+ }
6+ </script>
7+ <script type="text/javascript" async src="//s7.addthis.com/js/250/addthis_widget.js#pubid=<?php echo $ this ->getAddThisPubId (); ?> "></script>
Original file line number Diff line number Diff line change @@ -37,13 +37,5 @@ $_postCollection = $block->getPostCollection();
3737 </div>
3838
3939 <?php echo $ block ->getToolbarHtml () ?>
40-
41- <script type="text/javascript">var addthis_config = {"data_track_clickback":false};</script>
42- <script type="text/javascript" async src="//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4def63cd3cf37569"></script>
43- <script type="text/javascript">
44- var addthis_config = {
45- ui_language: "en",
46- data_track_clickback : false
47- }
48- </script>
40+ <?php echo $ this ->getChildHtml ('addthisJs ' ); ?>
4941<?php endif ; ?>
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments