diff --git a/src/Drupal/Driver/Fields/Drupal8/SupportedImageHandler.php b/src/Drupal/Driver/Fields/Drupal8/SupportedImageHandler.php new file mode 100644 index 0000000..ffcd572 --- /dev/null +++ b/src/Drupal/Driver/Fields/Drupal8/SupportedImageHandler.php @@ -0,0 +1,59 @@ +writeData($data, 'public://' . uniqid() . ".$file_extension"); + + if ($file === FALSE) { + throw new \Exception("Error saving file"); + } + + $file->save(); + + $return_values[] = [ + 'target_id' => $file->id(), + 'alt' => $value['alt'] ?? NULL, + 'title' => $value['title'] ?? NULL, + 'caption_value' => $value['caption_value'] ?? NULL, + 'caption_format' => $value['caption_format'] ?? NULL, + 'attribution_value' => $value['attribution_value'] ?? NULL, + 'attribution_format' => $value['attribution_format'] ?? NULL, + ]; + } + + return $return_values; + } + +}