Bolt\Controller\Frontend::homepage PHP Method

homepage() public method

Controller for the "Homepage" route. Usually the front page of the website.
public homepage ( Request $request ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request
return Bolt\Response\TemplateResponse
    public function homepage(Request $request)
    {
        $homepage = $this->getOption('theme/homepage') ?: $this->getOption('general/homepage');
        $listingparameters = $this->getListingParameters($homepage);
        $content = $this->getContent($homepage, $listingparameters);
        $template = $this->templateChooser()->homepage($content);
        $globals = [];
        if (is_array($content)) {
            $first = current($content);
            $globals[$first->contenttype['slug']] = $content;
            $globals['records'] = $content;
        } elseif (!empty($content)) {
            $globals['record'] = $content;
            $globals[$content->contenttype['singular_slug']] = $content;
            $globals['records'] = [$content->id => $content];
        }
        return $this->render($template, [], $globals);
    }