Merge pull request #1866 from bolt/feature/homepage-without-record

Configure homepage without a record or listing
This commit is contained in:
Bob den Otter
2020-09-16 16:37:59 +02:00
committed by GitHub

View File

@@ -22,6 +22,12 @@ class HomepageController extends TwigAwareController implements FrontendZoneInte
public function homepage(ContentRepository $contentRepository): Response
{
$homepage = $this->config->get('theme/homepage') ?: $this->config->get('general/homepage');
$templates = $this->templateChooser->forHomepage();
if ($homepage === null) {
return $this->render($templates);
}
$homepageTokens = explode('/', $homepage);
$contentType = $this->config->get('contenttypes/' . $homepageTokens[0]);
@@ -47,8 +53,6 @@ class HomepageController extends TwigAwareController implements FrontendZoneInte
$record = $contentRepository->findOneBy(['contentType' => $homepageTokens[0]]);
}
$templates = $this->templateChooser->forHomepage();
return $this->renderSingle($record, false, $templates);
}
}