You are here

function node_reference_feeds_get_source in References 7.2

Callback for mapping parent node references to child node reference values.

@codingStandardsIgnoreStart

Parameters

object $source: A FeedsSource object.

object $result: FeedsParserResult object.

string $key: The key as defined in the _feeds_parser_sources_alter() hook defined above.

Return value

array The node ids that the parent node references.

1 string reference to 'node_reference_feeds_get_source'
node_reference_feeds_parser_sources_alter in ./references.feeds.inc
Implements hook_feeds_parser_sources_alter().

File

./references.feeds.inc, line 49
References Feed File.

Code

function node_reference_feeds_get_source(FeedsSource $source, FeedsParserResult $result, $key) {

  // @codingStandardsIgnoreEnd
  if ($node = node_load($source->feed_nid)) {
    $results = array();
    $field = substr($key, 22);
    if (!empty($node->{$field}[LANGUAGE_NONE])) {
      foreach ($node->{$field}[LANGUAGE_NONE] as $value) {
        $results[] = $value[LANGUAGE_NONE];
      }
    }
    return $results;
  }
}