Skip to content
Snippets Groups Projects
Commit 4b03bced authored by Dieter Blomme's avatar Dieter Blomme
Browse files

Merge remote-tracking branch 'origin/2.0.x' into 2.x

* origin/2.0.x:
  Issue #3315782: Flexmail webform handler not matching flexmail API schema
parents 049c83cd 5bb9c50f
No related branches found
No related tags found
No related merge requests found
......@@ -243,7 +243,7 @@ class FlexmailWebformHandler extends FlexmailWebformHandlerBase {
// Set contact preferences if required.
if ($preference = $this->configuration['preference']) {
// First check if contact is already subscribed to selected preference.
$contact_preferences = $flexmailManager->getContactPreferenceSubscriptions($contact_id);
$contact_preferences = $flexmailManager->getContactPreferenceSubscriptions($contact_id)['_embedded']['item'] ?? [];
if (array_search($preference, array_column($contact_preferences, 'id')) === FALSE) {
try {
$flexmailManager->subscribeContactToPreference($contact_id, $preference);
......@@ -261,7 +261,7 @@ class FlexmailWebformHandler extends FlexmailWebformHandlerBase {
// Set contact interests if required.
if ($interest = $this->configuration['interest']) {
// First check if contact has interest label already assigned.
$contact_interests = $flexmailManager->getContactInterestLabels($contact_id);
$contact_interests = $flexmailManager->getContactInterestLabels($contact_id)['_embedded']['item'] ?? [];
if (array_search($interest, array_column($contact_interests, 'id')) === FALSE) {
try {
$flexmailManager->subscribeContactToInterestLabel($contact_id, $interest);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment