You are here

protected function FeedsNodeProcessor::newEntity in Feeds 8.2

Creates a new node in memory and returns it.

Overrides FeedsProcessor::newEntity

File

lib/Drupal/feeds/Plugin/feeds/processor/FeedsNodeProcessor.php, line 50
Contains \Drupal\feeds\Plugin\feeds\fetcher\FeedsNodeProcessor.

Class

FeedsNodeProcessor
Defines a node processor.

Namespace

Drupal\feeds\Plugin\feeds\processor

Code

protected function newEntity(FeedsSource $source) {
  $defaults = variable_get('node_options_' . $this
    ->bundle(), array(
    'status',
    'promote',
  ));
  $node = entity_create('node', array(
    'type' => $this
      ->bundle(),
    'changed' => REQUEST_TIME,
    'created' => REQUEST_TIME,
    'is_new' => TRUE,
    'log' => 'Created by FeedsNodeProcessor',
    'uid' => $this->config['author'],
    'promote' => (int) in_array('promote', $defaults),
    'status' => (int) in_array('status', $defaults),
  ));
  return $node
    ->getBCEntity();
}