public function testAllBlocksCreated() { $blocks = BlockFactory::createAllBlocks(); $this->assertCount(2, $blocks); $this->assertEquals(array("Link" => 'RedKiteCms\\Block\\Link\\Core\\LinkBlock', "Text" => 'RedKiteCms\\Block\\Text\\Core\\TextBlock'), BlockFactory::getAvailableBlocks()); $this->assertInstanceOf('\\RedKiteCms\\Block\\Link\\Core\\LinkBlock', $blocks[0]); $this->assertInstanceOf('\\RedKiteCms\\Block\\Text\\Core\\TextBlock', $blocks[1]); }
/** * Renders the slots * @param \RedKiteCms\FilesystemEntity\Page $page * * @return array */ protected function renderSlots(Page $page) { $templateRenderer = $this->options['page_renderer']; // We need to render all blocks to avoid problems when a kind ok block is // not present on a page $availableBlocks = array(); $blocks = BlockFactory::createAllBlocks(); foreach ($blocks as $block) { if ($block->isInternal()) { continue; } $availableBlocks[$block->getType()] = JsonTools::toJson($this->options["serializer"], $block); } $templateRenderer->render($page, array('available_blocks' => $availableBlocks)); $slots = $templateRenderer->getSlots(); $cmsBlocks = $templateRenderer->renderCmsBlocks($blocks, $this->options["username"], array('available_blocks' => $availableBlocks)); return array('slots' => $slots, 'cms_blocks' => $cmsBlocks, 'available_blocks' => $availableBlocks); }