/** * @param ReadNodeInterface $node * * @return array */ protected function transformBlock(ReadNodeInterface $node) { $blocksData = array(); /** @var ReadBlockInterface $block */ foreach ($node->getAreas() as $area) { foreach ($area->getBlocks() as $block) { $searchable = $block->getAttribute('searchable'); if (true === $searchable) { $contentBlock = $this->displayBlockManager->toString($block); if ('' !== $contentBlock) { $blocksData[] = array('type' => $block->getComponent(), 'content' => $contentBlock); } } } } return $blocksData; }
/** * Browse the hole $node to calculate the general cache policy of the $node * according to the areas and blocks. * If a block is private, the hole $node becomes private * The Max-age of the node is the min of the Max-age of all blocks * * @param ReadNodeInterface $node * * @return array */ public function getNodeCacheInfo(ReadNodeInterface $node) { return $this->getCacheInfoFromAreas($node->getAreas(), $node->getMaxAge()); }