You are here

private function FeedsCommerceProductMultiProcessor::getBundle in Commerce Feeds multitype 7

Read the current FeedsParserResult item and return the bundle value if present and valid.

IMPORTANT: It should only be called from within process().

Parameters

FeedsSource $source: The feeds source that will create the product

Return value

bool|string The bundle name if present and valid; FALSE otherwise

1 call to FeedsCommerceProductMultiProcessor::getBundle()
FeedsCommerceProductMultiProcessor::newEntity in plugins/FeedsCommerceProductMultiProcessor.inc
Creates a new product in memory and returns it.

File

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

Class

FeedsCommerceProductMultiProcessor
Creates products of different types from feed items.

Code

private function getBundle(FeedsSource $source) {
  $mappings = $source
    ->importer()->config['processor']['config']['mappings'];
  foreach ($mappings as $mapping) {
    if ($mapping['target'] == 'bundle') {
      $result = $this->commerce_feedsmulti_result;
      $bundle = $this
        ->getSourceValue($source, $result, $mapping['source']);

      // Don't trust the input to be a valid product type.
      if (!$bundle || !$this
        ->isBundleValid($bundle)) {
        $bundle = FALSE;
      }
      return $bundle;
    }
  }
  return FALSE;
}