/** * @inheritdoc */ protected function requestCanBeHandled(EntityInterface $entity) { $blogRoute = Plugin::getConfig('blogRootBlockName'); if ($entity instanceof Page && preg_match("/^({$blogRoute})(\\/|\$)/", $entity->getRoute())) { return parent::requestCanBeHandled($entity); } else { return false; } }
/** * Collects list of posts for current page * * @param Page $post */ public function collectListOfPosts(Page $post) { $pagesCollection = $post->getBlocksCollection(); $blogPostsCollection = $pagesCollection->getBlock(Plugin::getConfig('blogRootBlockName'))->getChildren(); $this->listOfPosts = $this->sortPosts($blogPostsCollection); }