You are here

protected function FeedsNodeProcessor::entityLoad in Feeds 7.2

Loads an existing node.

If the update existing method is not FEEDS_UPDATE_EXISTING, only the node table will be loaded, foregoing the node_load API for better performance.

@todo Reevaluate the use of node_object_prepare().

Overrides FeedsProcessor::entityLoad

File

plugins/FeedsNodeProcessor.inc, line 78
Class definition of FeedsNodeProcessor.

Class

FeedsNodeProcessor
Creates nodes from feed items.

Code

protected function entityLoad(FeedsSource $source, $nid) {
  $node = parent::entityLoad($source, $nid);
  if ($this->config['update_existing'] != FEEDS_UPDATE_EXISTING) {
    $node->uid = $this->config['author'];
  }
  node_object_prepare($node);

  // Workaround for issue #1247506. See #1245094 for backstory.
  if (!empty($node->menu)) {

    // If the node has a menu item(with a valid mlid) it must be flagged
    // 'enabled'.
    $node->menu['enabled'] = (int) (bool) $node->menu['mlid'];
  }

  // Populate properties that are set by node_object_prepare().
  if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
    $node->log = 'Updated by FeedsNodeProcessor';
  }
  else {
    $node->log = 'Replaced by FeedsNodeProcessor';
  }
  return $node;
}