Based on the element “Product-Box” I created my own element and the corresponding storefront-template. I only changed the names in the index.js.
In the backend, the data of the selected product is also correctly displayed and stored. But in the frontend I do not see any product. If I dump() the data in the storefront-template, the value data = null.
With the default product box element it works fine.
Does anybody have an idea what could be the reason for this?
I have the same problem at a custom text element. I copied the original text element to my extension. It’s working fine at the backend, but at the frontend element.data is null. But in translated -> config -> content -> value, there is my string. The original template uses {{ element.data.content|raw }} for the output which is null.
I searched the platform for instances of AbstractCmsElementResolver and then mirrored the location in my plugin. So I added it to Plugin/src/Core/Content/Media/Cms/Type and used the namespace Plugin\Core\Content\Media\Cms\Type. I then added the service to my Plugin/src/Resources/config/services.xml.
I am not 100% about why this works, nor why I need to create a DataResolver, or if this applies only to when I copy an element, as when I created a new custom element I did not have to create a resolver. If anyone has an answer to this, that would be great