You are here

function mailchimp_reformat_groupings in Mailchimp 7.3

Helper function to make an API-ready array from an interest group form.

2 calls to mailchimp_reformat_groupings()
mailchimp_lists_process_subscribe_form_choices in modules/mailchimp_lists/mailchimp_lists.module
Processor for various list form submissions.
mailchimp_signup_subscribe_form_submit in modules/mailchimp_signup/mailchimp_signup.module
Submit handler to add users to lists on subscription form submission.

File

./mailchimp.module, line 1257
Mailchimp module.

Code

function mailchimp_reformat_groupings($interest_groups) {
  $groupings = array();
  foreach ($interest_groups as $key => $groups) {
    if (is_array($groups)) {
      $groups = array_filter($groups);
      $groupings[] = array(
        'id' => $key,
        'groups' => $groups,
      );
    }
    else {
      $groupings[] = array(
        'id' => $key,
        'groups' => array(
          $groups => $groups,
        ),
      );
    }
  }
  return $groupings;
}