Merge branch 'issue/28'

[#28] Add parameter for preferred language
This commit is contained in:
Jens Schuppe 2022-05-02 15:25:10 +02:00
commit 1c649ba812
3 changed files with 18 additions and 1 deletions

View file

@ -200,6 +200,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);