You are here

public function FeedsNodeProcessor::getMappingTargets in Feeds 6

Same name and namespace in other branches
  1. 7.2 plugins/FeedsNodeProcessor.inc \FeedsNodeProcessor::getMappingTargets()
  2. 7 plugins/FeedsNodeProcessor.inc \FeedsNodeProcessor::getMappingTargets()

Return available mapping targets.

Overrides FeedsProcessor::getMappingTargets

File

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

Class

FeedsNodeProcessor
Creates nodes from feed items.

Code

public function getMappingTargets() {
  $targets = array(
    'title' => array(
      'name' => t('Title'),
      'description' => t('The title of the node.'),
    ),
  );

  // Include body field only if available.
  $type = node_get_types('type', $this->config['content_type']);
  if ($type->has_body) {

    // Using 'teaser' instead of 'body' forces entire content above the break.
    $targets['body'] = array(
      'name' => t('Body'),
      'description' => t('The body of the node. The teaser will be the same as the entire body.'),
    );
  }
  $targets += array(
    'nid' => array(
      'name' => t('Node ID'),
      'description' => t('The nid of the node. NOTE: use this feature with care, node ids are usually assigned by Drupal.'),
      'optional_unique' => TRUE,
    ),
    'uid' => array(
      'name' => t('User ID'),
      'description' => t('The Drupal user ID of the node author.'),
    ),
    'user_name' => array(
      'name' => t('Username'),
      'description' => t('The Drupal username of the node author.'),
    ),
    'user_mail' => array(
      'name' => t('User email'),
      'description' => t('The email address of the node author.'),
    ),
    'status' => array(
      'name' => t('Published status'),
      'description' => t('Whether a node is published or not. 1 stands for published, 0 for not published.'),
    ),
    'created' => array(
      'name' => t('Published date'),
      'description' => t('The UNIX time when a node has been published.'),
    ),
    'url' => array(
      'name' => t('URL'),
      'description' => t('The external URL of the node. E. g. the feed item URL in the case of a syndication feed. May be unique.'),
      'optional_unique' => TRUE,
    ),
    'guid' => array(
      'name' => t('GUID'),
      'description' => t('The external GUID of the node. E. g. the feed item GUID in the case of a syndication feed. May be unique.'),
      'optional_unique' => TRUE,
    ),
  );

  // Let other modules expose mapping targets.
  self::loadMappers();
  drupal_alter('feeds_node_processor_targets', $targets, $this->config['content_type']);
  return $targets;
}