foreach ($profileFields as $name => $field) {
//get only contact and activity fields.
//later stage we might going to consider contact type also.
- if (!in_array($field['field_type'], $supportableFieldTypes)) {
- continue;
- }
- if ($field['name'] == 'activity_engagement_level') {
- $responseFields[$cacheKey][$name] = $field;
- }
- // we should allow all supported custom data for survey
- // In case of activity, allow normal activity and with subtype survey,
- // suppress custom data of other activity types
- if (CRM_Core_BAO_CustomField::getKeyID($name) &&
- !in_array($field['html_type'], $removeFields)
- ) {
- if ($field['field_type'] != 'Activity') {
- $responseFields[$cacheKey][$name] = $field;
+ if (in_array($field['field_type'], $supportableFieldTypes)) {
+ // we should allow all supported custom data for survey
+ // In case of activity, allow normal activity and with subtype survey,
+ // suppress custom data of other activity types
+ if (CRM_Core_BAO_CustomField::getKeyID($name)) {
+ if (!in_array($field['html_type'], $removeFields)) {
+ if ($field['field_type'] != 'Activity') {
+ $responseFields[$cacheKey][$name] = $field;
+ }
+ elseif (array_key_exists(CRM_Core_BAO_CustomField::getKeyID($name), $customFields)) {
+ $responseFields[$cacheKey][$name] = $field;
+ }
+ }
}
- elseif (array_key_exists(CRM_Core_BAO_CustomField::getKeyID($name), $customFields)) {
+ else {
$responseFields[$cacheKey][$name] = $field;
}
}
- elseif (in_array('Primary', explode('-', $name)) ||
- CRM_Utils_Array::value('location_type_id', $field)
- ) {
- //get location related contact fields.
- $responseFields[$cacheKey][$name] = $field;
- }
}
return $responseFields[$cacheKey];