How to handle records of different "type" and different fields depending on the type?
Hey! I have a simple model called "Visual". It has the fields
How can I use different fields depending on the selected type in the Select for "type"?
To may make it little bit more challenging (for me): For each of those visual types we have packages to only install only the types we need for the website. The packages register them self in a VisualTypeRegistry. A VisualType object has a
name (string), type (enum) and settings (json). In a CMS the record should represent any type of visual objects like an image, a slider, a video, a chart, a pdf, whatever.. Each type has completely different fields which should be stored into settings column. So for example image just have a FileUpload. A slider has multiple FileUploads, a chart may have just a Codefield to insert a iframe-code or whatever...How can I use different fields depending on the selected type in the Select for "type"?
To may make it little bit more challenging (for me): For each of those visual types we have packages to only install only the types we need for the website. The packages register them self in a VisualTypeRegistry. A VisualType object has a
getKey() ``getLabel() and getSchema() function. Building the type Select works well depending on the key and the label. But now I don't know how to tell filament to use the getSchema() for the selected type.