diff --git a/config/assets.yaml b/config/assets.yaml index f156a954..8cb85b57 100644 --- a/config/assets.yaml +++ b/config/assets.yaml @@ -75,6 +75,9 @@ services: Pimcore\Bundle\StudioBackendBundle\Asset\Updater\Adapter\DataAdapter: tags: [ 'pimcore.studio_backend.update_adapter' ] + Pimcore\Bundle\StudioBackendBundle\Asset\Updater\Adapter\DataUriAdapter: + tags: [ 'pimcore.studio_backend.update_adapter' ] + # # Handler diff --git a/src/Asset/Attribute/Request/UpdateAssetRequestBody.php b/src/Asset/Attribute/Request/UpdateAssetRequestBody.php index fdb21104..855f3f8a 100644 --- a/src/Asset/Attribute/Request/UpdateAssetRequestBody.php +++ b/src/Asset/Attribute/Request/UpdateAssetRequestBody.php @@ -47,6 +47,7 @@ public function __construct() new UpdateStringProperty('key'), new UpdateStringProperty('locked'), new UpdateStringProperty('data'), + new UpdateStringProperty('dataUri'), new UpdateCustomMetadata(), new UpdateCustomSettingsData(), new UpdateElementProperties(), diff --git a/src/Asset/Updater/Adapter/DataUriAdapter.php b/src/Asset/Updater/Adapter/DataUriAdapter.php new file mode 100644 index 00000000..c9fe65d1 --- /dev/null +++ b/src/Asset/Updater/Adapter/DataUriAdapter.php @@ -0,0 +1,55 @@ +getIndexKey()]; + $assetData = substr($assetData, strpos($assetData, ',')); + $element->setData(base64_decode($assetData)); + } + + public function getIndexKey(): string + { + return self::INDEX_KEY; + } + + public function supportedElementTypes(): array + { + return [ + ElementTypes::TYPE_ASSET, + ]; + } +}