Skip to content

Fix asset reference updates for Statamic 6.6+ - #271

Merged
freekmurze merged 1 commit into
mainfrom
fix/asset-reference-updater-statamic-6.6
Apr 28, 2026
Merged

Fix asset reference updates for Statamic 6.6+#271
freekmurze merged 1 commit into
mainfrom
fix/asset-reference-updater-statamic-6.6

Conversation

@freekmurze

Copy link
Copy Markdown
Member

Summary

Fixes #270.

Statamic 6.6 removed AssetReferenceUpdater::getConfiguredAssetsFieldContainer() and reworked reference updates around a new UpdatesReferences trait on fieldtypes (statamic/cms@4730e89). Moving or deleting an asset throws Call to undefined method ResponsiveReferenceUpdater::getConfiguredAssetsFieldContainer() on Statamic 6.8.

This PR adopts the new API:

  • ResponsiveFieldtype uses the UpdatesReferences trait and implements replaceAssetReferences(), applying the existing *src rename/removal rules to the field's data.
  • ResponsiveReferenceUpdater and the custom UpdateResponsiveReferences subscriber are removed; Statamic's built-in UpdateAssetReferences listener now drives the flow (which also gains support for AssetReplaced for free).
  • The existing tests/Feature/AssetReferenceTest.php tests cover renames (string + array values), nested replicator fields, and deletions, and now pass on Statamic 6.15.

Statamic 6.6 removed the AssetReferenceUpdater::getConfiguredAssetsFieldContainer() helper and reworked reference updates around an UpdatesReferences trait on fieldtypes (statamic/cms@4730e89).

Adopt the new API: drop the custom ResponsiveReferenceUpdater and listener, and let the responsive fieldtype implement replaceAssetReferences() so Statamic's built-in UpdateAssetReferences subscriber handles renames and deletions.

Fixes #270
@freekmurze
freekmurze merged commit 6e562b6 into main Apr 28, 2026
7 checks passed
@freekmurze
freekmurze deleted the fix/asset-reference-updater-statamic-6.6 branch April 28, 2026 06:47
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.

Moving assets throws error

1 participant