- Issue created by @dejan0
- Status changed to Needs review
8 months ago 11:47am 2 September 2024 - First commit to issue fork.
- π§πͺBelgium dtfabio Ninove
I will create an MR, apply the patch and test the code.
- π§πͺBelgium dtfabio Ninove
Tested the code on Drupal version 10.4.6
Will test on 10.3 and D11 next later.
- π§πͺBelgium dtfabio Ninove
I get the following error on Drupal version 11.1.6:
The website encountered an unexpected error. Try again later. TypeError: Drupal\activecampaign_webform\Plugin\WebformHandler\ActiveCampaignFormHandler::getMappedValue(): Return value must be of type string, null returned in Drupal\activecampaign_webform\Plugin\WebformHandler\ActiveCampaignFormHandler->getMappedValue() (line 248 of modules/contrib/activecampaign/modules/activecampaign_webform/src/Plugin/WebformHandler/ActiveCampaignFormHandler.php). Drupal\activecampaign_webform\Plugin\WebformHandler\ActiveCampaignFormHandler->submitForm() (Line: 2758) Drupal\webform\Entity\Webform->invokeHandlers() (Line: 1924) Drupal\webform\WebformSubmissionForm->submitForm()
This happens when I use a custom composite field with several fields that are part of it. Then I get a nested array that the getMappedValue function cannot handle.
I will add a check here to see if the value is an array, so this can be looped to return the correct value.
Also think it might be good to return an empty string in case of a null value, to prevent this from happening for other currently unknown use cases as well.
- π§πͺBelgium dtfabio Ninove
I will take this up further at Drupal Dev days Leuven.