You are here

public function CommerceSmartImporerService::exportMultipleFields in Commerce Smart Importer 8

Exports groups of entity based on field_deifnitions.

File

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

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

public function exportMultipleFields($entity_type, $entity_id, $field_definitions) {
  if (empty($field_definitions)) {
    return [];
  }
  $entity = $this
    ->entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);
  $values = [];
  foreach ($field_definitions as $field_definition) {
    $values[] = $this
      ->exportField($entity, $field_definition);
  }
  return $values;
}