You are here

public function FeedsProcessor::getMappings in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsProcessor.inc \FeedsProcessor::getMappings()
  2. 7 plugins/FeedsProcessor.inc \FeedsProcessor::getMappings()

Get mappings.

Return value

array A list of configured mappings.

4 calls to FeedsProcessor::getMappings()
FeedsProcessor::hash in plugins/FeedsProcessor.inc
Create MD5 hash of item and mappings array.
FeedsProcessor::map in plugins/FeedsProcessor.inc
Execute mapping on an item.
FeedsProcessor::uniqueTargets in plugins/FeedsProcessor.inc
Returns all mapping targets that are marked as unique.
FeedsProcessor::validateFields in plugins/FeedsProcessor.inc
Validates fields of an entity.

File

plugins/FeedsProcessor.inc, line 1149
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

public function getMappings() {
  $cache =& drupal_static('FeedsProcessor::getMappings', array());
  if (!isset($cache[$this->id])) {
    $mappings = $this->config['mappings'];
    $targets = $this
      ->getCachedTargets();
    $languages = $this
      ->languageOptions();
    foreach ($mappings as &$mapping) {
      if (isset($targets[$mapping['target']]['preprocess_callbacks'])) {
        foreach ($targets[$mapping['target']]['preprocess_callbacks'] as $callback) {
          call_user_func_array($callback, array(
            $targets[$mapping['target']],
            &$mapping,
          ));
        }
      }

      // Ensure there's always a language set.
      if (empty($mapping['language'])) {
        $mapping['language'] = LANGUAGE_NONE;
      }
      else {

        // Check if the configured language is available. If not, fallback to
        // LANGUAGE_NONE.
        if (!isset($languages[$mapping['language']])) {
          $mapping['language'] = LANGUAGE_NONE;
        }
      }
    }
    $cache[$this->id] = $mappings;
  }
  return $cache[$this->id];
}