AddThis.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Magefan\Blog\Block\Social;
  3. use Magento\Store\Model\ScopeInterface;
  4. class AddThis extends \Magento\Framework\View\Element\Template
  5. {
  6. /**
  7. * Retrieve AddThis status
  8. *
  9. * @return boolean
  10. */
  11. public function getAddThisEnabled()
  12. {
  13. return (bool)$this->_scopeConfig->getValue(
  14. 'mfblog/social/add_this_enabled', ScopeInterface::SCOPE_STORE
  15. );
  16. }
  17. /**
  18. * Retrieve AddThis publisher id
  19. *
  20. * @return boolean
  21. */
  22. public function getAddThisPubId()
  23. {
  24. return $this->_scopeConfig->getValue(
  25. 'mfblog/social/add_this_pubid', ScopeInterface::SCOPE_STORE
  26. );
  27. }
  28. /**
  29. * Retrieve AddThis language code
  30. *
  31. * @return boolean
  32. */
  33. public function getAddThisLanguage()
  34. {
  35. return $this->_scopeConfig->getValue(
  36. 'mfblog/social/add_this_language', ScopeInterface::SCOPE_STORE
  37. );
  38. }
  39. public function toHtml()
  40. {
  41. if (!$this->getAddThisEnabled() || !$this->getAddThisPubId()) {
  42. return '';
  43. }
  44. return parent::toHtml();
  45. }
  46. }