Closed wahidnory closed 4 months ago
We have the Elgentos\PrismicIO\Block\Container
class for this which accepts the same data as a <container ... >
<block class="Elgentos\PrismicIO\Block\Container" name="deal_of_the_week_text">
<action method="addData">
<argument name="data" xsi:type="array">
<item name="htmlTag" xsi:type="string">div</item>
<item name="htmlClass" xsi:type="string">someclass some-other-class</item>
</argument>
</action>
<block class="Elgentos\PrismicIO\Block\Dom\RichText" template="text"/>
</block>
Besides of that you can also implement a \Elgentos\PrismicIO\ViewModel\HtmlSerializer
You can do some implementation of, extend it or create a plugin.
<block class="Elgentos\PrismicIO\Block\Dom\RichText" name="deal_of_the_week_text" template="text"/>
<arguments>
<argument name="htmlSerializer" xsi:type="object">\Elgentos\PrismicIO\ViewModel\HtmlSerializer</argument>
</arguments>
</block>
Currently we have the option to inject a RichText block with content and it generates whatever the user selected as the element type. Example:
What currently isn't possible is this:
This might be possible with a different implementation for the
HtmlSerializer
The serializer receives the object and the content. And returns the serialized content.
Food for thought but would be nice to have the ability to add extra classes the RichText block