You are here

function _getlocations_feeds_fill_targets in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_feeds/getlocations_feeds.module \_getlocations_feeds_fill_targets()

Helper function to add target fields

Parameters

$targets:

$module: Module name providing the field.

$field_name: Field name where values are supposed to get stored to.

$sub_fields: Getlocations Fields elements for the given $field_name

1 call to _getlocations_feeds_fill_targets()
getlocations_feeds_feeds_processor_targets_alter in modules/getlocations_feeds/getlocations_feeds.module
Implements hook_feeds_processor_targets_alter().

File

modules/getlocations_feeds/getlocations_feeds.module, line 56
getlocations_feeds.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function _getlocations_feeds_fill_targets(&$targets, $module, $field_name, $sub_fields) {
  foreach ($sub_fields as $sub_field => $value) {
    $callback = 'getlocations_feeds_set_target';

    /* This still doesn't work if country is not in ISO code */
    if ($sub_field == 'country') {
      $callback = 'getlocations_feeds_set_country';
    }
    $targets[$field_name . ':' . $sub_field] = array(
      'name' => $module . " module: " . $field_name . '.' . t('@label', array(
        '@label' => $value,
      )),
      'callback' => $callback,
      'description' => t('The @label for the location of the node.', array(
        '@label' => $sub_field,
      )),
      'real_target' => $field_name,
    );
  }
}