Constructing ad-hoc FieldLayout from config vs referencing saved FieldLayout records #11899
-
Instantiating ad-hoc field layouts via And, conveniently the field layout editor submits its data already formatted as a 'config' blob. With that in mind — if I'm developing a custom component that provides a field layout — Is it a bad practice to just store a config in the SavableComponent As far as I know, all the native components take care to save the FieldLayout record(s) separately in the db, reference them by ID, and handle updating them through Project Config. BUT... It seems like I can get away with not going through that more involved process, and everything still works fine. The possible downsides I can imagine, using this ad-hoc approach, include:
However, all these downsides seem more aesthetic than functional, at least on first pass. For example, the FieldLayout will calmly skip over any field that doesn't actually exist (e.g. on that has been deleted since the config was saved). And, other savable components include big ugly associative arrays in their Project Config sometimes, so is it really that bad?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Yeah should be totally fine.
The |
Beta Was this translation helpful? Give feedback.
Yeah should be totally fine.
The
fieldlayoutfields
table is hardly even used anymore. Really just there to aid older field layouts that haven’t been saved since before Craft 3.5. So this isn’t a big deal.