Info.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. namespace Magefan\Blog\Block\Post;
  9. use Magento\Store\Model\ScopeInterface;
  10. /**
  11. * Blog post info block
  12. */
  13. class Info extends \Magento\Framework\View\Element\Template
  14. {
  15. /**
  16. * Block template file
  17. * @var string
  18. */
  19. protected $_template = 'post/info.phtml';
  20. /**
  21. * DEPRECATED METHOD!!!!
  22. * Retrieve formated posted date
  23. * @var string
  24. * @return string
  25. */
  26. public function getPostedOn($format = 'Y-m-d H:i:s')
  27. {
  28. return $this->getPost()->getPublishDate($format);
  29. }
  30. /**
  31. * Retrieve 1 if display author information is enabled
  32. * @return int
  33. */
  34. public function authorEnabled()
  35. {
  36. return (int) $this->_scopeConfig->getValue(
  37. 'mfblog/author/enabled',
  38. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  39. );
  40. }
  41. /**
  42. * Retrieve 1 if author page is enabled
  43. * @return int
  44. */
  45. public function authorPageEnabled()
  46. {
  47. return (int) $this->_scopeConfig->getValue(
  48. 'mfblog/author/page_enabled',
  49. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  50. );
  51. }
  52. }