Add hook to alter interest groups in the way as $mergevars

Created on 9 December 2021, over 2 years ago
Updated 21 June 2024, 7 days ago

Problem/Motivation

Currently, it's possible to use an alter hook to update the $mergevars with additional data, but it's not currently possible to do the same with the Interest groups.

I'm updating a site that was developed prior to Interest Group support being added. It instead used a taxonomy to set extra $mergevars checkboxes, and these were then used to create Segments in Mailchimp.

Unfortunately our client has deleted and re-created their list, and Mailchimp no longer seems to support creating new MergeVars checkboxes, in favour of using Interest Groups instead.

This has left me in an awkward situation where I have data in their Drupal taxonomy fields which is disconnected from Mailchimp, with no easy way to copy it over.

Proposed resolution

Add a new mailchimp_lists_interest_groups hook to allow interest groups to be populated from other form field data.

API changes

Added mailchimp_lists_interest_groups hook.

/**
 * Alter interest groups before they are sent to Mailchimp.
 *
 * @param array $interests
 *   The current interest groups.
 * @param \Drupal\Core\Entity\EntityInterface $entity
 *   The entity used to populate the interest groups.
 * @param string $choices
 *   The entity form submission data.
 *
 * @ingroup mailchimp
 */
function hook_mailchimp_lists_interest_groups_alter(array &$interests, EntityInterface $entity, array $choices) {
}

✨ Feature request
Status

Fixed

Version

2.0

Component

Lists Module

Created by

πŸ‡¬πŸ‡§United Kingdom mattjones86 πŸ‡¬πŸ‡§ GMT+0

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024