- Issue created by @datawench
- πΊπ¦Ukraine nginex
Hi @datawench,
If the relevant asset represents a file entity, you can load a file entity and export it with
$embed_entities[] = $this->exporter->doExportToArray($file);
then simply populate the field value with new embedded entities, so in results it looks like this.
$value = $event->getFieldValue(); $embed_entities = []; foreach ($value as &$item) { // Find and fetch file from the text $item['value']. ... // Export file. $embed_entities[] = $this->exporter->doExportToArray($file); foreach ($embed_entities as $embed_entity) { $item['embed_entities'][] = $embed_entity; } } $event->setFieldValue($value);
If it's not a file entity, then pass file path to the private storage e.g.
$assets = $this->privateTempStore->get('export.assets') ?? []; if (!in_array($filepath, $assets, TRUE)) { $assets[] = $filepath; $this->privateTempStore->set('export.assets', $assets); }
where $this->privateTempStore is $container->get('single_content_sync.store')
The import will automatically handle it.