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 templates support #165

Closed qzminski closed 6 months ago

qzminski commented 7 months ago

The rsce_foobar.html.twig templates seem to work fine, except when you try to extend the Contao base template:

{% extends “@Contao/content_element/_base.html.twig” %}

Then, you get the following error:

CleanShot 2024-02-21 at 12 49 00@2x

It's obviously related to the fact that this file is treated as a legacy template, and thus has a different context. Possible solutions:

  1. Copy-paste the required context from here: https://github.com/contao/contao/blob/796f20fb5e2d6db01f6d80b3820eff4c806b3be5/core-bundle/src/Controller/ContentElement/AbstractContentElementController.php#L85-L99
  2. Convert this element to a service controller: https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/master/src/Element/CustomElement.php
ausi commented 6 months ago

2. Convert this element to a service controller…

As this would not be backwards compatible, I added forward compatibility by setting the required context in c69bf399c9fc6d87ab6114194a0a0ec16bf33466 manually. Can you please try if the latest dev-master works for you?

ausi commented 6 months ago

Regarding the switch to fragment controllers, see #162

qzminski commented 6 months ago

@ausi looks good at first sight, thanks!

ausi commented 6 months ago

Released as version 2.4.7