You are here

function hook_mailchimp_lists_merge_values in Mailchimp 7.2

Return an array of matching merge values.

Parameters

$mergevars:

$account:

$list:

Return value

array

1 function implements hook_mailchimp_lists_merge_values()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

mailchimp_lists_mailchimp_lists_merge_values in modules/mailchimp_lists/mailchimp_lists.module
Implements hook_mailchimp_lists_merge_values().
1 invocation of hook_mailchimp_lists_merge_values()
mailchimp_lists_load_user_mergevars in modules/mailchimp_lists/mailchimp_lists.module
Get the relevant merge vars for the given user for the given list.

File

./mailchimp.api.php, line 58
Mailchimp hook definitions.

Code

function hook_mailchimp_lists_merge_values($mergevars, $account, $list) {
  $values = array();

  // grab the saved list merge vars and filter out unset values
  if (!empty($list->settings['mergefields'])) {
    $mergevars = array_filter($list->settings['mergefields']);
    $mergevars = array_flip($mergevars);

    // match with token values
    $values = module_invoke_all('mailchimp_lists_merge_values', $mergevars, $account, $list);

    // always add email
    $values += array(
      'EMAIL' => $account->mail,
    );
  }
  return $values;
}