- $mappingHeader = array_keys((array) $this->_mapperFields, $mappingName[$i]);
- $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL;
- $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0;
- $phoneType = $processor->getPhoneTypeID($i);
- $imProvider = $processor->getIMProviderID($i);
-
- if ($websiteTypeId) {
- $defaults["mapper[$i]"] = [$mappingHeader[0], $websiteTypeId];
- }
- else {
- if (!$locationId) {
- $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n";
- }
- //default for IM/phone without related contact
- $typeId = NULL;
- if (isset($phoneType)) {
- $typeId = $phoneType;
- }
- elseif (isset($imProvider)) {
- $typeId = $imProvider;
- }
- $defaults["mapper[$i]"] = [$mappingHeader[0] ?? '', $locationId, $typeId];
- }
-
- if ((!$phoneType) && (!$imProvider)) {
- $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n";
- }
-
- $js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n";
+ $defaults["mapper[$i]"] = $processor->getSavedQuickformDefaultsForColumn($i);
+ $js .= $processor->getQuickFormJSForField($i);