Skip to content

[6.x] Add option to copy data when replacing an asset - #15865

Open
ryanmitchell wants to merge 1 commit into
statamic:6.xfrom
ryanmitchell:replace-asset-keep-data
Open

ryanmitchell wants to merge 1 commit into
statamic:6.xfrom
ryanmitchell:replace-asset-keep-data

Conversation

@ryanmitchell

Copy link
Copy Markdown
Contributor

Closes #12047

When replacing an asset with a file that has a different name, the original asset's data (alt text, custom blueprint fields, focal point etc.) was lost, so editors had to fill it all in again.

This PR adds a Copy Data toggle to the Replace action modal (on by default). When enabled, the original asset's data is merged onto the new asset before the replacement happens. Values from the original take precedence over any matching fields already on the new asset. File meta like dimensions and size still come from the new file.

Tests added in tests/Actions/ReplaceAssetTest.php.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

While replacing an asset with new file meta data get lost

1 participant