/** * @param BlockInterface $block * * @return array */ protected function createBlocks(BlockInterface $block) { $content = array(); $content['id'] = $block->getId(); $content['name'] = $block->getName(); $content['enabled'] = $block->getEnabled(); $content['position'] = $block->getPosition(); $content['settings'] = $block->getSettings(); $content['type'] = $block->getType(); $content['created_at'] = $block->getCreatedAt()->format('U'); $content['updated_at'] = $block->getUpdatedAt()->format('U'); $content['blocks'] = array(); foreach ($block->getChildren() as $child) { $content['blocks'][] = $this->createBlocks($child); } return $content; }