Un-deprecate assembleLayout()
, or abstract assembleLayoutFromPost()
#9676
-
Refer to #6625 I'd like to see the current Field Manager in particular now has this issue, where it allows exporting field config to JSON, for later import. As a demonstration of this issue, see spicywebau/craft-neo#489 where the reliance on the field layout being assembled via POST params make it impossible to assign a field layout to a blocktype. Despite having the exact same config data, just from stored JSON. The PR linked scoots around this issue. Vizy has similar issues, where the data for field settings, where the data is stored a bit differently to play nice with Vue, and multiple block type definitions. I'm sure this one is an edge-case of my own making. Opening this as a discussion because:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Craft already has a built-in way to serialize a field layout into a portable, JSON-encodable array (FieldLayout::getConfig()), and a way to unserialize those arrays back into FieldLayout models (FieldLayout::createFromConfig()). They’re both used for storing field layouts in the project config, but could apply to other use cases as well. The main reason |
Beta Was this translation helpful? Give feedback.
-
Yep, and that's exactly what I'm using |
Beta Was this translation helpful? Give feedback.
Craft already has a built-in way to serialize a field layout into a portable, JSON-encodable array (FieldLayout::getConfig()), and a way to unserialize those arrays back into FieldLayout models (FieldLayout::createFromConfig()). They’re both used for storing field layouts in the project config, but could apply to other use cases as well.
The main reason
assembleLayout()
has been deprecated is because it doesn’t support any of the new field layout features that were added in Craft 3.5. If it weren’t for that, I wouldn’t have any problem continuing to support it even if only for plugins’ sake.