You are here

function constant_contact_build_field_mappings in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.3 constant_contact.module \constant_contact_build_field_mappings()

Formats field mappings into array.

2 calls to constant_contact_build_field_mappings()
constant_contact_user_insert in ./constant_contact.module
Implements hook_user_insert().
constant_contact_user_update in ./constant_contact.module
Implements hook_update_user().

File

./constant_contact.module, line 1366

Code

function constant_contact_build_field_mappings() {
  if (isset($GLOBALS['cc_extra_field_mappings'])) {
    return $GLOBALS['cc_extra_field_mappings'];
  }
  $mappings = variable_get('cc_extra_field_mappings', array());
  $field_mappings = explode(',', $mappings);
  $GLOBALS['cc_extra_field_mappings'] = array();
  if ($field_mappings) {
    foreach ($field_mappings as $mapping) {
      $bits = explode(':', $mapping);
      if (is_array($bits) && isset($bits[0], $bits[1])) {
        $GLOBALS['cc_extra_field_mappings'][trim($bits[0])] = trim($bits[1]);
      }
    }
  }
  return $GLOBALS['cc_extra_field_mappings'];
}