Skip to content

Commit e746c66

Browse files
jheimbachJohannes Heimbachsolverat
authored
Allow fields in fieldcollections to be mapped individually (#355)
* Allow fields in fieldcollections to be mapped indiviually * restrict repeater container in object mapping Co-authored-by: Johannes Heimbach <j.heimbach@anymotion.de> Co-authored-by: Stefan Hagspiel <shagspiel@dachcom.ch>
1 parent c7afcb7 commit e746c66

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

UPGRADE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Upgrade Notes
22

33
## Version 4.1.4
4-
- **[BUGFIX]**: Fix link to translation list
4+
- **[BUGFIX]**: Fix link to translation list [#359](https://github.com/dachcom-digital/pimcore-formbuilder/pull/359)
55
- **[BUGFIX]**: skip dependency if document is null [@JHeimbach](https://github.com/dachcom-digital/pimcore-formbuilder/pull/354)
66
- **[BUGFIX]**: Check for valid success management configuration [#299](https://github.com/dachcom-digital/pimcore-formbuilder/issues/299)
7-
- **[NEW FEATURE]**: Add Mail-Log Filter to Email Channel [#297](https://github.com/dachcom-digital/pimcore-formbuilder/issues/297)
7+
- **[NEW FEATURE]**: Add Mail-Log Filter to Email Channel [#297](https://github.com/dachcom-digital/pimcore-formbuilder/issues/297)
8+
- **[NEW FEATURE]**: Allow mapping of elements in fieldset container in Object Chanel [@JHeimbach](https://github.com/dachcom-digital/pimcore-formbuilder/pull/355)
89

910
## Version 4.1.3
1011
- **[BUGFIX]**: Fix `ignoreFields` Assignment: Use `CollectionType` instead of `ChoiceType` [#352](https://github.com/dachcom-digital/pimcore-formbuilder/pull/352)

src/FormBuilderBundle/OutputWorkflow/Channel/Object/AbstractObjectResolver.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,13 @@ protected function mapContainerField(DataObject\Concrete $object, array $contain
178178

179179
// there could be more than just one data field assignment
180180
foreach ($fieldDefinition['childs'] as $formDefinitionChild) {
181+
181182
if ($formDefinitionChild['type'] !== 'data_class_field') {
183+
184+
foreach ($containerFieldData['fields'] ?? [] as $field) {
185+
$this->processObjectData($object, $field);
186+
}
187+
182188
continue;
183189
}
184190

src/FormBuilderBundle/Resources/public/js/extjs/extensions/formObjectMappingEditor/formObjectTreeMapper.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Formbuilder.extjs.extensions.formObjectMappingEditorConfigurator.formObjectTreeM
133133
var treeItems,
134134
_ = this;
135135

136-
var generateFields = function (fields, treeItems, parent) {
136+
var generateFields = function (fields, treeItems) {
137137

138138
Ext.Array.each(fields, function (field) {
139139

@@ -191,19 +191,16 @@ Formbuilder.extjs.extensions.formObjectMappingEditorConfigurator.formObjectTreeM
191191
}
192192
};
193193

194-
if (fieldData.hasOwnProperty('fields') && Ext.isArray(fieldData.fields) && fieldData.type === 'container') {
194+
// allow all container types except repeater!
195+
if (fieldData.hasOwnProperty('fields') && Ext.isArray(fieldData.fields) && (fieldData.type === 'container' && fieldData.sub_type !== 'repeater')) {
195196
item.omContainerFields = fieldData.fields;
197+
item.children = generateFields(fieldData.fields,[])
196198
}
197199

198200
// do not add any data to form item, if it has been forced disabled
199201
item = forcedDisabled ? item : _.resolveItemChildren(item);
200202

201-
if (parent) {
202-
parent.children.push(item);
203-
} else {
204-
treeItems.push(item);
205-
}
206-
203+
treeItems.push(item);
207204

208205
}.bind(this));
209206

@@ -298,7 +295,6 @@ Formbuilder.extjs.extensions.formObjectMappingEditorConfigurator.formObjectTreeM
298295
}.bind(this),
299296
handler: function (grid, rowIndex) {
300297

301-
console.log(rowIndex);
302298
var record = grid.getStore().getAt(rowIndex),
303299
fieldData = this.buildFormFieldConfigFromNode(record);
304300

@@ -548,7 +544,10 @@ Formbuilder.extjs.extensions.formObjectMappingEditorConfigurator.formObjectTreeM
548544
}
549545

550546
if (fieldData.hasOwnProperty('childs') && Ext.isArray(fieldData.childs) && fieldData.childs.length > 0) {
551-
return this.findStoredConfigNodeData(item, fieldData.childs);
547+
d = this.findStoredConfigNodeData(item, fieldData.childs);
548+
if (d !== null) {
549+
return false;
550+
}
552551
}
553552
}.bind(this));
554553

@@ -616,4 +615,4 @@ Formbuilder.extjs.extensions.formObjectMappingEditorConfigurator.formObjectTreeM
616615
getWorker: function (workerName, correspondingFieldName, data) {
617616
return new Formbuilder.extjs.extensions.formObjectMappingEditorWorker[workerName](this.formId, this.pimcoreClassId, correspondingFieldName, data);
618617
}
619-
});
618+
});

0 commit comments

Comments
 (0)