[#28] Add parameter for preferred language and pass to XCM

This commit is contained in:
Jens Schuppe 2020-06-04 14:21:06 +02:00
parent ceb1f5a753
commit 36a756e4dd
2 changed files with 16 additions and 0 deletions

View file

@ -177,6 +177,14 @@ class CRM_Twingle_Submission {
}
}
// Prepare values: language.
if (!empty($contact_data['preferred_language'])) {
$mapping = CRM_Core_I18n_PseudoConstant::longForShortMapping();
// Override the default mapping for German.
$mapping['de'] = 'de_DE';
$contact_data['preferred_language'] = $mapping[$contact_data['preferred_language']];
}
// Pass to XCM.
$contact_data['contact_type'] = $contact_type;
$contact = civicrm_api3('Contact', 'getorcreate', $contact_data);