You are here

public function CommerceSmartImporerService::exportImage in Commerce Smart Importer 8

Helper function for exportField.

Exports filename.

1 call to CommerceSmartImporerService::exportImage()
CommerceSmartImporerService::exportField in src/Plugin/CommerceSmartImporerService.php
Force different types of fields to string.

File

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

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

public function exportImage($entity, $field_definition) {
  $values = [];
  foreach ($entity
    ->get($field_definition['machine_names'])
    ->getValue() as $item) {
    $values[] = $this
      ->entityTypeManager()
      ->getStorage('file')
      ->load($item['target_id'])
      ->getFilename();
  }
  $values = implode('|', $values);
  return $values;
}