oveleon/contao-cookiebar

Template prefix for fe_page to specific?

OMOSde opened this issue · 3 comments

Contao allows the selection fe_page* in the 'Page template' setting (Layout " Expert settings).

But the cookiebar needs fe_page_* (in https://github.com/oveleon/contao-cookiebar/blob/master/src/EventListener/FrontendTemplateListener.php#L31).

This leads to the fact that e.g. scripts and CSS are not loaded and therefore the cookiebar does not work, if the template is named fe_page-new for example.

Then I would look to allow it just like Contao (without the _) and let everything through that starts with fe_page*.

$arrPageTemplates = System::getContainer()->getParameter('contao_cookiebar.page_templates') ?? ['fe_page'];
if (!in_array($template, $arrPageTemplates) && 0 !== strpos($template, 'fe_page_')) {
return $buffer;
}

For now, you would need to add the template to your config.yaml:
https://github.com/oveleon/contao-cookiebar/blob/master/docs/BASICS.md#basic-configuration

Thanks for the tip. In my case i simply renamed the template.

Fixed in 1.12.4