You are here

public function CivicrmDataSourceHandler::getCiviCrmEntityInfoFromMapping in CRM Core 7

Returns CiviCRM entity info based on mapping.

3 calls to CivicrmDataSourceHandler::getCiviCrmEntityInfoFromMapping()
CivicrmDataSourceHandler::getCiviCrmEntityBundleFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns CiviCRM entity bundle based on mapping.
CivicrmDataSourceHandler::getCiviCrmEntityDeltaFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns CiviCRM delta bundle based on mapping.
CivicrmDataSourceHandler::getCiviCrmEntityTypeFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns CiviCRM entity type based on mapping.

File

modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc, line 419

Class

CivicrmDataSourceHandler

Code

public function getCiviCrmEntityInfoFromMapping($mapping, $drupal_entity_type, $drupal_entity_bundle) {
  $controller = crm_core_data_import_get_destination_entity_controller($drupal_entity_type);
  foreach ($mapping as $mapping_key => $mapping_item) {
    list($entity_type, $entity_bundle, ) = explode(':', $mapping_key);
    if ($entity_type == $controller && $entity_bundle == $drupal_entity_bundle) {
      list($civicrm_entity_type, $civicrm_entity_bundle, $delta) = explode(':', $mapping_item['primary']['source_field_primary']);
      return array(
        'type' => $civicrm_entity_type,
        'bundle' => $civicrm_entity_bundle,
        'delta' => $delta,
      );
    }
  }
}