You are here

function iframe_feeds_set_target in Iframe 7

Callback for mapping iframe fields.

2 string references to 'iframe_feeds_set_target'
iframe_feeds_processor_targets in mappers/iframe.inc
Implements hook_feeds_processor_targets().
iframe_init in ./iframe.module
Support for local-domain iframes and autoresize the height

File

mappers/iframe.inc, line 43
On behalf implementation of Feeds mapping API for iframe.module.

Code

function iframe_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
  $language = $mapping['language'];
  list($field_name, $column) = explode(':', $target);
  $field = isset($entity->{$field_name}) ? $entity->{$field_name} : array(
    $language => array(),
  );
  $delta = 0;
  foreach ($values as $value) {
    if (is_object($value) && $value instanceof FeedsElement) {
      $value = $value
        ->getValue();
    }
    if (is_scalar($value)) {
      $field[$language][$delta][$column] = (string) $value;
    }
    $delta++;
  }
  $entity->{$field_name} = $field;
}