/** * Replace the default template * * @param Template $template */ public function onParseTemplate(Template $template) { // Do not override if the current scope is not frontend or the template has a custom template set // or the Bootstrap is not enabled if ($this->requestStack->getCurrentRequest()->get('_scope') !== ContaoCoreBundle::SCOPE_FRONTEND || $template->customTpl || !$this->isBootstrapEnabled()) { return; } $templateName = $template->getName(); // Do not override if there is no mapped template if (!$this->templateMapper->has($templateName)) { return; } $template->setName($this->templateMapper->get($templateName)); }