CreateEventFromTemplate does not write custom fields correctly
How to reproduce the problem
- create an Custom Field for Events
- create an FormProcessor that create an Event with the Formprocessor Action: CreateEventFromTemplate
- Try out Formprocessor
Expected Result:
- event should be created
- custom fields of event sould be filled
Actual result
- event is created
- custom fields of event are empty
Comparison
I tried the same with CreateOrUpdateEvent (which useses api3). With CreateOrUpdateEvent the custom Fields are filled correctly. But because I need to create an Event from a Template with custom Fields we need to fix the CreateEventFromTemplate action.
Research in Code
CreateEventFromTemplate and CreateOrUpdateEvent are very similar.
But CreateEventFromTemplate uses APIv4 but sends the parameters in apiv3 style: custom_xxx So there seems to be something wrong with the parameter specification.
Code of CreateEventFromTemplate Custom Field Specification:
$customGroups = $config->getCustomGroupsForEntity('Event');
foreach ($customGroups as $customGroup) {
if (!empty($customGroup['is_active'])) {
$specs->addSpecification(CustomField::getSpecForCustomGroup($customGroup['id'], $customGroup['name'], $customGroup['title']));
}
}
The Function CustomField::getSpecForCustomGroup
seems to create the custom_xxx notation (see here ).
Maybe we need a replacement for this for apiv4 calls?
What solution would you recommend?