You are here

public function FeedsParser::getMappingSources in Feeds 8.2

Declare the possible mapping sources that this parser produces.

Return value

An array of mapping sources, or FALSE if the sources can be defined by typing a value in a text field.

Example:

array(
  'title' => t('Title'),
  'created' => t('Published date'),
  'url' => t('Feed item URL'),
  'guid' => t('Feed item GUID'),
);

Related topics

3 calls to FeedsParser::getMappingSources()
FeedsSimplePieParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSimplePieParser.php
Return mapping sources.
FeedsSitemapParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSitemapParser.php
Implements FeedsParser::getMappingSources().
FeedsSyndicationParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSyndicationParser.php
Return mapping sources.
4 methods override FeedsParser::getMappingSources()
FeedsCSVParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsCSVParser.php
Override parent::getMappingSources().
FeedsSimplePieParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSimplePieParser.php
Return mapping sources.
FeedsSitemapParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSitemapParser.php
Implements FeedsParser::getMappingSources().
FeedsSyndicationParser::getMappingSources in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSyndicationParser.php
Return mapping sources.

File

lib/Drupal/feeds/Plugin/FeedsParser.php, line 67
Contains FeedsParser and related classes.

Class

FeedsParser
Abstract class, defines interface for parsers.

Namespace

Drupal\feeds\Plugin

Code

public function getMappingSources() {
  self::loadMappers();
  $sources = array();
  $content_type = feeds_importer($this->id)->config['content_type'];
  drupal_alter('feeds_parser_sources', $sources, $content_type);
  if (!feeds_importer($this->id)->config['content_type']) {
    return $sources;
  }
  $sources['parent:uid'] = array(
    'name' => t('Feed node: User ID'),
    'description' => t('The feed node author uid.'),
  );
  $sources['parent:nid'] = array(
    'name' => t('Feed node: Node ID'),
    'description' => t('The feed node nid.'),
  );
  return $sources;
}