Skip to content

Fix Brevo multiple-choice attributes receiving a comma-separated string - #3148

Merged
engram-design merged 1 commit into
verbb:craft-5from
theluckystrike:fix/brevo-multiple-choice-attributes
Nov 19, 2026
Merged

engram-design merged 1 commit into
verbb:craft-5from
theluckystrike:fix/brevo-multiple-choice-attributes

Conversation

@theluckystrike

Copy link
Copy Markdown
Contributor

Fixes #3147.

Brevo::_convertFieldType() maps float, date and boolean and falls back to a string for everything else, so a Brevo attribute of type multiple-choice became a string integration field. A Checkboxes field mapped to it sent "Option A, Option B", and Brevo ignored the value because it expects an array of strings.

The fix maps multiple-choice to IntegrationField::TYPE_ARRAY. OptionsField already returns its values as an array for array integration fields, which is how the GetResponse and ActiveCampaign checkbox mappings work, so the payload becomes ["Option A", "Option B"].

Test

tests/Unit/BrevoCustomFieldTypeTest.php builds the custom fields from a Brevo attributes response with a multiple-choice, a text and a float attribute and checks each type.

  • craft-5: fails, INTERESTS is string
  • this branch: passes

I don't have DDEV on this machine, so I ran the Brevo tests in tests/Unit with Pest and a minimal bootstrap (Composer autoload plus the Yii and Craft class files, no Craft app). The new test and the 5 existing tests in BrevoDynamicListAssignmentTest.php pass on PHP 8.5. The only notices are the PHP 8.5 deprecation of ReflectionMethod::setAccessible().

…ng (verbb#3147)

Brevo::_convertFieldType() had no entry for the multiple-choice attribute
type, so these attributes became string integration fields and a
Checkboxes field mapped to one sent "Option A, Option B". Brevo expects
an array of strings and ignored the value. Map multiple-choice to
IntegrationField::TYPE_ARRAY, so options fields send their values as an
array, as they already do for GetResponse and ActiveCampaign.
@engram-design
engram-design merged commit 9bb122e into verbb:craft-5 Nov 19, 2026
@engram-design

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Brevo integration doesn't support multiple-choice attributes

2 participants