public function CiviCrmCustomFields::prepareRow in CRM Core 7
Process row of data.
Overrides CRMCoreConversionHandler::prepareRow
File
- modules/
crm_core_data_import/ plugins/ conversion/ CiviCrmCustomFields.inc, line 25
Class
Code
public function prepareRow(&$row, $importer) {
foreach ($row as $key => $value) {
$civicrm_entity = array();
list($civicrm_entity['type'], $civicrm_entity['bundle'], $civicrm_entity['field']) = explode(':', $key);
$field = $this
->getCiviCrmFieldInstance($civicrm_entity['type'], $civicrm_entity['field']);
if ($this
->isCustomField($field)) {
// @see civicrm/CRM/Core/BAO/CustomField.php - CRM_Core_BAO_CustomField::dataType().
if (!empty($field['data_type'])) {
switch ($field['data_type']) {
case 'Country':
$row->{$key} = $this
->convertConstant('countryIsoCode', $value);
break;
case 'StateProvince':
$row->{$key} = $this
->convertConstant('stateProvinceAbbreviation', $value);
break;
}
}
}
}
}