You are here

private function CommerceSmartImporerService::formatValuesArray in Commerce Smart Importer 8

Helper function for createNewProduct.

Formats values from field log.

1 call to CommerceSmartImporerService::formatValuesArray()
CommerceSmartImporerService::createNewProduct in src/Plugin/CommerceSmartImporerService.php
Creates product.

File

src/Plugin/CommerceSmartImporerService.php, line 1503
Main Commerce Smart Importer Service.

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

private function formatValuesArray($field_log, $field_definitions) {
  $values = [];
  foreach ($field_definitions as $key => $field_definition) {
    if (array_key_exists($key, $field_log)) {
      $values[$field_definition['machine_names']] = count($field_log[$key]['values']) == 1 ? current($field_log[$key]['values']) : $field_log[$key]['values'];
    }
  }
  return $values;
}