-
- {{#each this.collectionValue key="index" as |data index|}}
- {{yield
- (hash
- Field=(component
- FKField
- errors=@errors
- collectionName=@name
- collectionIndex=index
- addError=@addError
- data=@data
- set=@set
- registerField=@registerField
- unregisterField=@unregisterField
- triggerRevalidationFor=@triggerRevalidationFor
+ {{#let (element this.tagName) as |Wrapper|}}
+ {{#each this.collectionData key="index" as |data index|}}
+
+ {{yield
+ (hash
+ Field=(component
+ FKField
+ errors=@errors
+ collectionIndex=index
+ addError=@addError
+ data=@data
+ set=@set
+ registerField=@registerField
+ unregisterField=@unregisterField
+ triggerRevalidationFor=@triggerRevalidationFor
+ parentName=(concat this.name "." index)
+ )
+ Object=(component
+ FKObject
+ errors=@errors
+ addError=@addError
+ data=@data
+ set=@set
+ registerField=@registerField
+ unregisterField=@unregisterField
+ triggerRevalidationFor=@triggerRevalidationFor
+ parentName=(concat this.name "." index)
+ )
+ Collection=(component
+ FKCollection
+ errors=@errors
+ addError=@addError
+ data=@data
+ set=@set
+ registerField=@registerField
+ unregisterField=@unregisterField
+ triggerRevalidationFor=@triggerRevalidationFor
+ parentName=(concat this.name "." index)
+ remove=@remove
+ )
+ remove=this.remove
)
- remove=this.remove
- )
- index
- }}
+ index
+ (get this.collectionData index)
+ }}
+
{{/each}}
-
+ {{/let}}
}
diff --git a/app/assets/javascripts/discourse/app/form-kit/components/fk/field-data.gjs b/app/assets/javascripts/discourse/app/form-kit/components/fk/field-data.gjs
index 3d1fa93d64f..7a3be6c168b 100644
--- a/app/assets/javascripts/discourse/app/form-kit/components/fk/field-data.gjs
+++ b/app/assets/javascripts/discourse/app/form-kit/components/fk/field-data.gjs
@@ -146,13 +146,11 @@ export default class FKFieldData extends Component {
throw new Error("@name can't include `.` or `-`.");
}
- return (
- (this.args.collectionName ? `${this.args.collectionName}.` : "") +
- (this.args.collectionIndex !== undefined
- ? `${this.args.collectionIndex}.`
- : "") +
- this.args.name
- );
+ if (this.args.parentName) {
+ return `${this.args.parentName}.${this.args.name}`;
+ }
+
+ return this.args.name;
}
/**
diff --git a/app/assets/javascripts/discourse/app/form-kit/components/fk/field.gjs b/app/assets/javascripts/discourse/app/form-kit/components/fk/field.gjs
index dafc2c2b2c9..575dd005c1a 100644
--- a/app/assets/javascripts/discourse/app/form-kit/components/fk/field.gjs
+++ b/app/assets/javascripts/discourse/app/form-kit/components/fk/field.gjs
@@ -57,7 +57,7 @@ export default class FKField extends Component {
@registerField={{@registerField}}
@format={{@format}}
@disabled={{@disabled}}
- @collectionName={{@collectionName}}
+ @parentName={{@parentName}}
as |field|
>