You are here

function weight_feeds_set_target in Weight 7.2

Callback for mapping weights.

Parameters

$source: Field mapper source settings.

$entity: An entity object, for instance a node object.

$target: A string identifying the target on the node.

$value: The value to populate the target with.

$mapping: Associative array of the mapping settings from the per mapping configuration form.

1 string reference to 'weight_feeds_set_target'
weight_feeds_processor_targets_alter in ./weight.module
Implements hook_feeds_processor_targets_alter()

File

./weight.module, line 508

Code

function weight_feeds_set_target($source, $entity, $target, $values) {
  if (!is_array($values)) {
    $values = array(
      $values,
    );
  }
  $weight = NULL;
  foreach ($values as $value) {
    if (is_numeric($value)) {
      $weight = $value;
      break;
    }
  }
  $entity->weight_weight = $weight;
}