Recent.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © 2015 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\Sidebar;
  9. /**
  10. * Blog sidebar categories block
  11. */
  12. class Recent extends \Magefan\Blog\Block\Post\PostList\AbstractList
  13. {
  14. use Widget;
  15. /**
  16. * @var string
  17. */
  18. protected $_widgetKey = 'recent_posts';
  19. /**
  20. * @return $this
  21. */
  22. public function _construct()
  23. {
  24. $this->setPageSize(
  25. (int) $this->_scopeConfig->getValue(
  26. 'mfblog/sidebar/'.$this->_widgetKey.'/posts_per_page',
  27. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  28. )
  29. );
  30. return parent::_construct();
  31. }
  32. /**
  33. * Retrieve block identities
  34. * @return array
  35. */
  36. public function getIdentities()
  37. {
  38. return [\Magento\Cms\Model\Block::CACHE_TAG . '_blog_recent_posts_widget' ];
  39. }
  40. }