You are here

function openlayers_cck_feeds_set_target in Openlayers 6.2

Same name and namespace in other branches
  1. 6 modules/openlayers_cck/includes/openlayers_cck.feeds.inc \openlayers_cck_feeds_set_target()

Set Feeds Target

Callback for mapping. Here we map feeds data to the actual field of the node.

1 string reference to 'openlayers_cck_feeds_set_target'
_openlayers_cck_feeds_node_processor_targets_alter in modules/openlayers_cck/includes/openlayers_cck.feeds.inc
Private function for hook of same name.

File

modules/openlayers_cck/includes/openlayers_cck.feeds.inc, line 38
File for feeds module integration

Code

function openlayers_cck_feeds_set_target(&$node, $target, $value) {

  // The field name is the target
  $field_name = $target;

  // Load the field from the node
  $field = isset($node->{$field_name}) ? $node->{$field_name} : array();

  // Handle multiple value fields.
  if (is_array($value)) {
    $i = 0;
    foreach ($value as $v) {
      if (!is_array($v) && !is_object($v)) {
        $field[$i]['openlayers_wkt'] = $v;
      }
      $i++;
    }
  }
  else {
    $field[0]['openlayers_wkt'] = $value;
  }
  $node->{$field_name} = $field;
}