dachcom-digital / pimcore-formbuilder

Pimcore Formbuilder - create forms easily!
Other
92 stars 47 forks source link

API Output Channel: Field Mapping: allow different label and value #462

Closed simon-matt-oetztal closed 2 months ago

simon-matt-oetztal commented 3 months ago

Hi,

for our API implementation (Emarsys) we need to map the fields to numeric field ids. These numbers are not very meaningful to the users. So it would be nice if it's possible to pass a meaningful label for the user:

https://github.com/dachcom-digital/pimcore-formbuilder/blob/0be1a0c3f8fb0034f9efb8a7d51806bfd715939b/src/Controller/Admin/OutputWorkflowApiController.php#L112C1-L121C6

maybe something like:

    protected function validateApPredefinedFields(array $fields): array
    {
        return array_map(static function ($property) {
            if(is_array($property) && key_exists('label', $property) && key_exists('value', $property)) {
                return [
                    'label' => $property['label'],
                    'value' => $property['value']
                ];
            }

            return [
                'label' => $property,
                'value' => $property
            ];

        }, $fields);
    }

Thx, Simon

solverat commented 2 months ago

image image