feat(16.2-01): compile, decode and load plugin field types in cabana
- compileFieldTypes builds a per-boot field type registry (alias, core and cross-plugin collisions, element prefix, assets, option keys) passed down the compile functions; settings and relation forms refuse plugin aliases - fields.yaml accepts a plugin alias with the general keys plus the type's options (typeOptions, element, translatable in the schema); CheckOptions runs at boot; CompileFormWithTypes for plugin tests - save decodes plugin values inside the transaction (FormFieldError is a 422, other errors opaque 500) and answers meta.notices (FieldNotice) only when a type reported something; show and save serve values through Load - GET /field-types lists the types with versioned asset URLs; OpenAPI, schema.d.ts, README and docs/backend/field-types.md updated
This commit is contained in:
@@ -88,9 +88,23 @@ type RelationOption struct {
|
||||
// actions the requesting admin may run and that apply to the record, in
|
||||
// declared order; only the show response fills it, and it is omitted when no
|
||||
// action is offered.
|
||||
//
|
||||
// Notices are the messages plugin field types returned while saving the
|
||||
// record (pact.FormFieldDecoded), localized in the request locale; only the
|
||||
// create and update responses carry them, and the key is omitted when no type
|
||||
// reported anything.
|
||||
type RecordMeta struct {
|
||||
Labels map[string][]RelationOption `json:"labels"`
|
||||
Actions []RecordAction `json:"actions,omitempty"`
|
||||
Notices []FieldNotice `json:"notices,omitempty"`
|
||||
}
|
||||
|
||||
// FieldNotice is one save notice: the field it is about, the content locale
|
||||
// of the value for a translatable field type, and the localized message.
|
||||
type FieldNotice struct {
|
||||
Field string `json:"field"`
|
||||
Locale string `json:"locale,omitempty"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// RecordEnvelope is the show, create and update response.
|
||||
|
||||
Reference in New Issue
Block a user