feat(16.2-01): translatable plugin fields, element uploads and save notices in the admin
- MLPluginField wraps PluginField in the MLField locale switcher; the
element gets the active content locale and that locale's string
- isMLField treats a translatable plugin field as a locale map in the form
state, FormView adopt and the relation child modal
- summer-upload posts the file with the admin session to the field upload
route and answers summer-upload-result {id, url} or {id, error}
- noticeLines shows meta.notices under each field as a warning status line
(text only) and in the saved toast; the stored value is reloaded
- docs/backend/field-types.md documents the full element contract;
modules/boardwalk/dist rebuilt
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
// locale-switching wrapper, MLField, around the text, textarea and markdown
|
||||
// controls; each holds a locale -> text map, labelled as a group.
|
||||
// Phase 16.2 adds plugin field types (D-13): a field whose schema carries an
|
||||
// `element` renders PluginField whatever its type alias, holds a form value
|
||||
// and is labelled as a group. Look such fields up with rendererForField and
|
||||
// `element` renders PluginField whatever its type alias (MLPluginField, the
|
||||
// MLField locale switcher around it, when the type is translatable), holds a
|
||||
// form value and is labelled as a group. Look such fields up with rendererForField and
|
||||
// isRegisteredField, which know the field, not only its type.
|
||||
import type { Component } from 'vue'
|
||||
import type { FormField } from '../../api/types'
|
||||
@@ -30,6 +31,7 @@ import FileuploadField from './fields/FileuploadField.vue'
|
||||
import NumberField from './fields/NumberField.vue'
|
||||
import PartialField from './fields/PartialField.vue'
|
||||
import PasswordField from './fields/PasswordField.vue'
|
||||
import MLPluginField from './fields/MLPluginField.vue'
|
||||
import PluginField from './fields/PluginField.vue'
|
||||
import PermissionEditorField from './fields/PermissionEditorField.vue'
|
||||
import RelationManager from '../relation/RelationManager.vue'
|
||||
@@ -115,7 +117,7 @@ export function isPluginField(field: Pick<FormField, 'element'>): boolean {
|
||||
/** The control of one field: a plugin field type's host, else rendererFor its type. */
|
||||
export function rendererForField(field: FormField): Component {
|
||||
if (isPluginField(field)) {
|
||||
return PluginField
|
||||
return field.translatable ? MLPluginField : PluginField
|
||||
}
|
||||
return rendererFor(field.type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user