You are here

public function CivicrmDataSourceHandler::getDrupalEntityInfoFromMapping in CRM Core 7

Returns Drupal entity info based on mapping.

4 calls to CivicrmDataSourceHandler::getDrupalEntityInfoFromMapping()
CivicrmDataSourceHandler::getDrupalEntityBundleFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns Drupal entity bundle based on mapping.
CivicrmDataSourceHandler::getDrupalEntityDeltaFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns Drupal entity delta based on mapping.
CivicrmDataSourceHandler::getDrupalEntityTypeFromMapping in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns Drupal entity type based on mapping.
CivicrmDataSourceHandler::getEntitiesForRelationships in modules/crm_core_data_import/plugins/source/CivicrmDataSourceHandler.inc
Returns list of entities which has relationships.

File

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

Class

CivicrmDataSourceHandler

Code

public function getDrupalEntityInfoFromMapping($mapping, $civicrm_desired_entity_type, $civicrm_desired_entity_bundle) {
  foreach ($mapping as $mapping_key => $mapping_item) {
    if (!empty($mapping_item['primary']['source_field_primary'])) {
      list($civicrm_entity_type, $civicrm_entity_bundle, $delta) = explode(':', $mapping_item['primary']['source_field_primary']);
      if ($civicrm_entity_type == $civicrm_desired_entity_type && $civicrm_entity_bundle == $civicrm_desired_entity_bundle) {
        list($drupal_controller_entity_type, $drupal_entity_bundle, $delta) = explode(':', $mapping_key);
        return array(
          'type' => crm_core_data_import_get_destination_entity_type($drupal_controller_entity_type),
          'bundle' => $drupal_entity_bundle,
          'delta' => $delta,
        );
      }
    }
  }
}