You are here

function mailchimp_lists_mailchimp_lists_merge_tokens in Mailchimp 7.2

Implements hook_mailchimp_lists_merge_tokens().

File

modules/mailchimp_lists/mailchimp_lists.module, line 737
Mailchimp lists module.

Code

function mailchimp_lists_mailchimp_lists_merge_tokens() {
  $tokens = array();

  // Grab user tokens. Support nested tokens of one level.
  $token_info = token_info();
  if (!empty($token_info['tokens']['user'])) {
    $tokens = $token_info['tokens']['user'];
    foreach ($tokens as $key => $info) {
      if (isset($info['type']) && isset($token_info['tokens'][$info['type']])) {
        foreach ($token_info['tokens'][$info['type']] as $key2 => $info2) {

          // Add in nested tokens.
          $info2['name'] = $info['name'] . ' - ' . $info2['name'];
          $tokens[$key . ':' . $key2] = $info2;
        }
      }
    }
  }
  return $tokens;
}