wn-blocks-plugin icon indicating copy to clipboard operation
wn-blocks-plugin copied to clipboard

Basic implementation that changes the Blocks formwidget to extend MLR…

Open nmiyazaki-chapleau opened this issue 1 year ago • 0 comments

Basic implementation that changes the Blocks formwidget to extend MLRepeater and customizes the getLocaleSaveData to add the _group and _config to the save data. Also changes all blocks to use the Translate version (ml*).

This should be used alongside my PR for the wintercms/wn-translate-plugin's wip-ml-repeater-fields draft PR branch, at least until it gets merged into the draft PR branch.

This implementation is basic and very very rough around the edges, but is a working proof of concept. This POC forces users to use Translate. Ideally, there should be an easier way to override the getLocaleSaveData and extend the MLRepeater without forcing its use. A potential idea could be to just have an MLBlocks formwidget alongside the Blocks formwidget and add blocks that implement the ML versions.

I'm not a fan of using the formWidgets' data key as it is deprecated and should only be for backwards compatibility, but I did not find a simpler way for now.

The best implementation IMO would be to be able to add a translatable property to block fields which would make them use the ML version of their formwidget. I am not sure how the translatable property implementation in the wip-ml-repeater-fields branch is going, however.

I will gladly take any ideas or suggestions to improve this!

nmiyazaki-chapleau avatar Jun 04 '24 13:06 nmiyazaki-chapleau