+ $fieldName = strtolower($entityfield);
+ if(!strstr($fieldName, '-')) {
+ if(strtolower($realName) != $fieldName) {
+ // we want to keep the '-' pattern for locations but otherwise
+ // we are going to make the api-standard field the main / preferred name but support the db name
+ // in future naming the fields in the DB to reflect the way the rest of the api / BAO / metadata works would
+ // reduce code
+ $fieldName = strtolower($realName);
+ }
+ if(isset($entityGetFieldsResult[$realName]['uniqueName'])) {
+ // we won't alias the field name on here are we are using uniqueNames for the possibility of needing to differentiate
+ // which entity 'status_id' belongs to
+ $fieldName = $entityGetFieldsResult[$realName]['uniqueName'];
+ }
+ else{
+ if(isset($entityGetFieldsResult[$realName]['name'])) {
+ // this will sort out membership_type_id vs membership_type
+ $fieldName = $entityGetFieldsResult[$realName]['name'];
+ }
+ }
+ }
+ $profileFields[$profileID][$fieldName] = array_merge($entityGetFieldsResult[$realName], $profileFields[$profileID][$entityfield]);
+ if(!isset($profileFields[$profileID][$fieldName]['api.aliases'])) {
+ $profileFields[$profileID][$fieldName]['api.aliases'] = array();
+ }