You are here

function _location_feeds_fill_targets in Location Feeds 7

Same name and namespace in other branches
  1. 6 location_feeds.module \_location_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: Location elements for the given $field_name

2 calls to _location_feeds_fill_targets()
location_feeds_feeds_processor_targets_alter in ./location_feeds.module
Implements feeds_node_processor_target_alter().
_location_feeds_location in ./location_feeds.module
Helper function to handle node and user locations

File

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

Code

function _location_feeds_fill_targets(&$targets, $module, $field_name, $sub_fields) {
  foreach ($sub_fields as $sub_field => $value) {
    $callback = 'location_feeds_set_target';
    if ($sub_field == 'country') {
      $callback = 'location_feeds_set_country';
    }
    else {
      if (strpos($sub_field, 'locpick]') !== FALSE) {
        $callback = 'location_feeds_set_point';
      }
    }
    $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,
      )),
    );
  }

  // support georss
  $targets[$field_name . ':georss:point'] = array(
    'name' => $module . " module:" . $field_name . " georss:point",
    'callback' => 'location_feeds_set_georss_point',
    'description' => t('Map a georss point to location points'),
  );
}