You are here

function location_feeds_feeds_processor_targets_alter in Location Feeds 7

Implements feeds_node_processor_target_alter().

Parameters

$targets array of target fields:

$entity_type:

$bundle_name:

File

./location_feeds.module, line 25
This module provides location mappers to feed importers.

Code

function location_feeds_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
  if ($entity_type == 'node') {

    // location.module logic
    $settings = variable_get('location_settings_node_' . $bundle_name, array());

    // Only add fields when collecting locations
    if (isset($settings['multiple']['max']) && $settings['multiple']['max'] > 0) {
      _location_feeds_location($targets, $settings);
    }

    // Location cck logic.
    if (module_exists('location_cck')) {
      $fields = field_read_fields(array(
        'module' => 'location_cck',
      ));
      $location_fields = _location_feeds_fields();
      foreach ($fields as $field_name => $field) {
        _location_feeds_fill_targets($targets, 'location_cck', $field_name, $location_fields);
      }
    }
  }
  else {
    if ($entity_type == 'user') {
      $settings = variable_get('location_settings_user', array());

      // Only add fields when collecting locations
      if (isset($settings['multiple']['max']) && $settings['multiple']['max'] > 0) {
        _location_feeds_location($targets, $settings);
      }
    }
  }
}