Skip to content

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

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
ryanmitchell:replace-asset-keep-data
Nov 20, 2026
Merged

jasonvarga merged 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>
@jasonvarga
jasonvarga merged commit cacbb17 into statamic:6.x Nov 20, 2026
62 checks passed
@ryanmitchell
ryanmitchell deleted the replace-asset-keep-data branch November 21, 2026 05:56
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

2 participants