diff --git a/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php b/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php index 04a44bee3..4482aeeb5 100644 --- a/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php +++ b/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php @@ -16,6 +16,7 @@ use Victoire\Bundle\BusinessPageBundle\Entity\VirtualBusinessPage; use Victoire\Bundle\CoreBundle\Exception\IdentifierNotDefinedException; use Victoire\Bundle\CoreBundle\Helper\UrlBuilder; +use Victoire\Bundle\PageBundle\Entity\PageStatus; use Victoire\Bundle\ViewReferenceBundle\Builder\ViewReferenceBuilder; /** @@ -272,6 +273,9 @@ private function populatePage(VirtualBusinessPage $page, BusinessTemplate $busin $page->setSlug($pageSlug); $page->setName($pageName); $page->setReference($this->viewReferenceBuilder->buildViewReference($page, $em)); + if (false === $entity->isVisibleOnFront()) { + $page->setStatus(PageStatus::UNPUBLISHED); + } return $page; } diff --git a/Bundle/SitemapBundle/Domain/Export/SitemapExportHandler.php b/Bundle/SitemapBundle/Domain/Export/SitemapExportHandler.php index d1e324b41..88a5d6253 100644 --- a/Bundle/SitemapBundle/Domain/Export/SitemapExportHandler.php +++ b/Bundle/SitemapBundle/Domain/Export/SitemapExportHandler.php @@ -148,8 +148,10 @@ private function getBusinessPages(ViewReference $tree, $businessPages = []) ) { /** @var WebViewInterface $businessPage */ $businessPage = $this->pageHelper->findPageByReference($child); - $businessPage->setReference($child); - $businessPages[] = $businessPage; + if ($businessPage->isPublished()) { + $businessPage->setReference($child); + $businessPages[] = $businessPage; + } } $businessPages = $this->getBusinessPages($child, $businessPages); }