/** * @dataProvider pageTreeCollectionRepository */ public function testPageTreeCollection($languages, $pages, $templates, $expectedlanguages, $expectedPages) { $this->configureLanguagesRepository($languages); $this->configurePagesRepository($pages); $this->configureBlocksRepository(); $this->configureSeoRepository($languages, $pages); $this->configureTheme($templates); $pageTreeCollection = new PageTreeCollection($this->assetsManager, $this->activeTheme, $this->templateManager, $this->pageBlocks, $this->factoryRepository); $pageTreeCollection->fill(); $this->assertCount($expectedlanguages, $pageTreeCollection->getPages()); $this->assertCount($expectedPages, $pageTreeCollection->getBasePages()); }
/** * Generated the site map * * @param string $websiteUrl * @return string */ protected function generateSiteMap($websiteUrl) { $urls = array(); foreach ($this->pageTreeCollection->getPages() as $pageTree) { $page = $pageTree->getPage(); if (!$page->getIsPublished()) { continue; } $seo = $pageTree->getSeo(); $permalink = ""; if (!$pageTree->getLanguage()->getMainLanguage() || !$page->getIsHome()) { $permalink = $seo->getPermalink(); } $urls[] = array('href' => $websiteUrl . $permalink, 'frequency' => $seo->getSitemapChangefreq(), 'priority' => $seo->getSitemapPriority()); } return $this->templating->render('RedKiteCmsBundle:Sitemap:sitemap.html.twig', array('urls' => $urls)); }
/** * Saves the pages instantiating an PageTreeCollection object * * @param \RedKiteLabs\ThemeEngineBundle\Core\Theme\Theme $theme * @param array $options An array of options * @return boolean */ protected function savePages(Theme $theme, array $options) { $pages = $this->pageTreeCollection->getPages(); $basePages = $this->pageTreeCollection->getBasePages(); $options["type"] = "Pages"; if (!$this->doSavePages($pages, $theme, $options)) { return false; } $options["type"] = "Base"; if (!$this->doSavePages($basePages, $theme, $options)) { return false; } return true; }