You are here

public function FeedsCommerceProductMultiProcessor::getMappingTargets in Commerce Feeds multitype 7

Return available mapping targets.

Overrides FeedsCommerceProductProcessor::getMappingTargets

File

plugins/FeedsCommerceProductMultiProcessor.inc, line 67
Class definition of FeedsCommerceProductMultiProcessor.

Class

FeedsCommerceProductMultiProcessor
Creates products of different types from feed items.

Code

public function getMappingTargets() {
  $targets['bundle'] = array(
    'name' => t("Product type"),
    'description' => t("The type of the product"),
    'callback' => 'commerce_feedsmulti_blank_callback',
    'summary_callbacks' => array(),
  );
  $targets += parent::getMappingTargets();

  // Loop through every product type to get all possible mapping targets. This
  // would cause problems if targets could vary between bundles (I don't know
  // of that being possible).
  $entity_type = $this
    ->entityType();
  $bundles = commerce_product_types();
  foreach ($bundles as $bundle => $info) {
    if ($bundle != $this->config['bundle']) {
      $new_targets = module_invoke_all('feeds_processor_targets', $entity_type, $bundle);
      drupal_alter('feeds_processor_targets', $new_targets, $entity_type, $bundle);
      $targets += $new_targets;
    }
  }
  return $targets;
}