You are here

public function FeedsFeedNodeProcessor::setTargetElement in Feeds 6

Same name and namespace in other branches
  1. 7 plugins/FeedsFeedNodeProcessor.inc \FeedsFeedNodeProcessor::setTargetElement()

Override setTargetElement to operate on a target item that is a node.

Overrides FeedsProcessor::setTargetElement

File

plugins/FeedsFeedNodeProcessor.inc, line 153
Class definition of FeedsFeedNodeProcessor.

Class

FeedsFeedNodeProcessor
Creates *feed* nodes from feed items. The difference to FeedsNodeProcessor is that this plugin only creates nodes that are feed nodes themselves.

Code

public function setTargetElement(&$target_node, $target_element, $value) {
  if ($target_element == 'source') {

    // Get the class of the feed node importer's fetcher and set the source
    // property. See feeds_nodeapi() how $node->feeds gets stored.
    $class = get_class($this
      ->feedNodeImporter()->fetcher);
    $target_node->feeds[$class]['source'] = $value;
  }
  elseif ($target_element == 'body') {
    $target_node->teaser = $value;
    $target_node->body = $value;
  }
  elseif (in_array($target_element, array(
    'title',
    'status',
    'created',
  ))) {
    $target_node->{$target_element} = $value;
  }
}