_categoryCollection = $categoryCollection; } /** * Get grouped categories * @return \Magefan\Blog\Model\ResourceModel\Category\Collection */ public function getGroupedChilds() { $k = 'grouped_childs'; if (!$this->hasData($k)) { $array = $this->_categoryCollection ->addActiveFilter() ->addStoreFilter($this->_storeManager->getStore()->getId()) ->setOrder('position') ->getTreeOrderedArray(); $this->setData($k, $array); } return $this->getData($k); } /** * Retrieve true if need to show posts count * @return int */ public function showPostsCount() { $key = 'show_posts_count'; if (!$this->hasData($key)) { $this->setData($key, (bool)$this->_scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/show_posts_count', ScopeInterface::SCOPE_STORE )); } return $this->getData($key); } /** * Retrieve block identities * @return array */ public function getIdentities() { return [\Magento\Cms\Model\Block::CACHE_TAG . '_blog_categories_widget' ]; } }