I’ve implemented three custom CMS blocks via the official way in a plugin.
However, I need to make the content of the via Shopping Experiences added and administered blocks available in Twig templates also.
My approach: Using the cms_blocks repository with a ContainsFilter on ‚type‘ containing the type of the mentioned blocks. This works fine but I’m struggling with finding a solution to fetch the content of the slots of the blocks in order to make it available via a Twig extension in templates later. Is there a cleaner way to do this other than injecting the cms_slots repository on top and using the fetched ids of the custom blocks within an EqualsAnyFilter and cascaed down the object hierarchy in order to access the desired content attribute? Do I need a custom Data Resolver in order to implement this feature in a convenient way?
The WIP feature is currently implemented as a GenericPageLoadedEvent subscriber.