generate() публичный Метод

Generates a sitemap for given webspace.
public generate ( string $webspaceKey, string $locale, boolean $flat = false ) : WebspaceSitemap
$webspaceKey string
$locale string
$flat boolean
Результат WebspaceSitemap
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function sitemapFunction($locale = null, $webspaceKey = null)
 {
     if ($webspaceKey === null) {
         $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
     }
     if ($locale === null) {
         $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocalization();
     }
     return $this->sitemapGenerator->generate($webspaceKey, $locale)->getSitemap();
 }
Пример #2
0
 public function testGenerateTree()
 {
     $result = $this->sitemapGenerator->generate('sulu_io', 'en')->getSitemap();
     $root = $result;
     $this->assertEquals('Homepage', $root['title']);
     $this->assertEquals('/', $root['url']);
     $this->assertEquals(1, $root['nodeType']);
     $layer1 = array_values($root['children']);
     $this->assertEquals(3, sizeof($layer1));
     $this->assertEquals('News en', $layer1[0]['title']);
     $this->assertEquals('/news', $layer1[0]['url']);
     $this->assertEquals(1, $layer1[0]['nodeType']);
     $this->assertEquals('Products-2 en', $layer1[1]['title']);
     $this->assertEquals(4, $layer1[1]['nodeType']);
     $this->assertEquals('http://www.asdf.at', $layer1[1]['url']);
     $this->assertEquals('Products-3 en', $layer1[2]['title']);
     $this->assertEquals('/news', $layer1[2]['url']);
     $this->assertEquals(2, $layer1[2]['nodeType']);
     $layer21 = array_values($layer1[0]['children']);
     $this->assertEquals('News-1 en', $layer21[0]['title']);
     $this->assertEquals('/news/news-1', $layer21[0]['url']);
     $this->assertEquals(1, $layer21[0]['nodeType']);
     $this->assertEquals('News-2 en', $layer21[1]['title']);
     $this->assertEquals('/news/news-2', $layer21[1]['url']);
     $this->assertEquals(1, $layer21[1]['nodeType']);
 }