public function homepage($content) { // First candidate: Global config.yml file. $template = $this->app['config']->get('general/homepage_template'); // Second candidate: Theme-specific config.yml file. if ($this->app['config']->get('theme/homepage_template')) { $template = $this->app['config']->get('theme/homepage_template'); } // Fallback if no content: index.twig if (empty($content) && empty($template)) { $template = 'index.twig'; } // Fallback with content: use record() or listing() to choose template if (empty($template)) { if (is_array($content)) { $first = current($content); return $this->listing($first->contenttype); } else { return $this->record($content); } } else { return $template; } }