madeyourday / contao-rocksolid-custom-elements

RockSolid Custom Elements Contao Extension
http://rocksolidthemes.com/de/contao/plugins/custom-content-elements
MIT License
48 stars 12 forks source link

Twig support is broken on Contao 5.3.1 #172

Closed feam-codes closed 3 months ago

feam-codes commented 7 months ago

After updating Contao from 5.3.0 to 5.3.1 I got these errors in the backend if I open an article for editing its content:

Could not find template "rsce_intro"" at TemplateLoader.php line 156

The frontend works further as expected. Perhaps it has something to do with the changes from https://github.com/contao/contao/pull/6936?

ausi commented 7 months ago

I was not able to reproduce that. What is the exact path and name of your template and config file?

feam-codes commented 7 months ago

The templates and config files are placed under templates/wertgrund for example:

templates/wertgrund/rsce_intro.html.twig
templates/wertgrund/rsce_intro_config.php

I tried to clear the cache, but nothing changed. The frontend works, but the backend throws these errors for all articles. This is the complete log:

[2024-03-17T17:53:59.590502+01:00] request.INFO: Matched route "contao_backend". {"route":"contao_backend","route_parameters":{"_route":"contao_backend","_scope":"backend","_token_check":true,"_controller":"Contao\\CoreBundle\\Controller\\BackendController::mainAction"},"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","method":"GET"} {"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","request_method":"GET"}
[2024-03-17T17:53:59.736036+01:00] request.CRITICAL: Uncaught PHP Exception Exception: "Could not find template "rsce_intro"" at TemplateLoader.php line 156 {"exception":"[object] (Exception(code: 0): Could not find template \"rsce_intro\" at /Users/fludwig/Sites/projects/fcm/wertgrund/contao/vendor/contao/core-bundle/contao/library/Contao/TemplateLoader.php:156)"} {"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","request_method":"GET"}
[2024-03-17T17:53:59.752756+01:00] messenger.INFO: Sending message Contao\CoreBundle\Messenger\Message\SearchIndexMessage with contao_prio_low sender using Contao\CoreBundle\Messenger\Transport\AutoFallbackTransport {"class":"Contao\\CoreBundle\\Messenger\\Message\\SearchIndexMessage","alias":"contao_prio_low","sender":"Contao\\CoreBundle\\Messenger\\Transport\\AutoFallbackTransport"} {"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","request_method":"GET"}
[2024-03-17T17:53:59.752969+01:00] messenger.INFO: Received message Contao\CoreBundle\Messenger\Message\SearchIndexMessage {"class":"Contao\\CoreBundle\\Messenger\\Message\\SearchIndexMessage"} {"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","request_method":"GET"}
[2024-03-17T17:53:59.753786+01:00] messenger.INFO: Message Contao\CoreBundle\Messenger\Message\SearchIndexMessage handled by Contao\CoreBundle\Messenger\MessageHandler\SearchIndexMessageHandler::__invoke {"class":"Contao\\CoreBundle\\Messenger\\Message\\SearchIndexMessage","handler":"Contao\\CoreBundle\\Messenger\\MessageHandler\\SearchIndexMessageHandler::__invoke"} {"request_uri":"https://wertgrund.fcm.contao-public.d.locdev/contao?do=article&id=1&ref=qH9SLiX1&rt=626343fc463cd76e2b330.9HXscR5CtBzM_1FY8cGpoIhn_7mOO5TQZ-ykJ5PX-X4.hjmeBm0jxiS5vBVgxrfd8L8yj9LfXtOfH4XrE8SbsRqnLbVDWyvZQ5-LEA&table=tl_content","request_method":"GET"}
mlwebworker commented 7 months ago

In einem Themeordner wird das nicht funktionieren, wenn kein gleichnamiges globales Template existiert. https://docs.contao.org/manual/de/layout/templates/twig/verwaltung/#themespezifische-templates

feam-codes commented 7 months ago

Bedeutet das im Umkehrschluss, dass es in Version 5.3.0 vom Template-Loader falsch gemacht wird? Dann müsste ich tatsächlich meine Template-Struktur überdenken. 🤔

ausi commented 7 months ago

I think this probably needs to be fixed in Contao itself: https://github.com/contao/contao/pull/7027

berecont commented 7 months ago

I fell in the same issue. What should be the correct folder for rsce_foo.html.twig? At 5.3.0 I'm working with .\templates\theme\rsce_foo.html.twig .\templates\theme\rsce_foo_config.php

berecont commented 7 months ago

I just set a template .\templates\theme\rsce_foo.html5 with <div></div> in it » everything works fine. And in the frontend I can see my content set from .\templates\theme\rsce_foo.html.twig

ausi commented 7 months ago

It is a bug with Contao 5.3.1 and it needs to be fixed in Contao or in the extension, but I’m not sure yet which is the right one.