Skip to content

[6.x] Localizable Asset Meta Data#13928

Open
jackmcdade wants to merge 24 commits into6.xfrom
localizable-asset-meta-data
Open

[6.x] Localizable Asset Meta Data#13928
jackmcdade wants to merge 24 commits into6.xfrom
localizable-asset-meta-data

Conversation

@jackmcdade
Copy link
Copy Markdown
Member

@jackmcdade jackmcdade commented Feb 13, 2026

References statamic/ideas#223

CleanShot 2026-02-13 at 12 19 15@2x CleanShot 2026-02-13 at 12 20 15@2x

Note

Medium Risk
Touches core asset metadata persistence/caching and CP/API update flows to support per-site values, which could affect existing meta files and save behavior in multi-site setups. Includes migration logic and UI changes that need verification across localized and non-localized containers.

Overview
Adds localizable asset metadata for multi-site installs, allowing asset field data (eg alt/title) to vary per site while still supporting inherited “origin” values.

Updates the asset model/repository to store meta data per locale (with an optional sites origin map), make meta caching locale-aware, avoid materializing inherited values on save, and treat focal point (focus) as non-localized.

Extends CP and API/GraphQL endpoints to accept a site parameter and return localization context (available sites, origin values/meta, modified localized fields), and updates the asset editor/fieldtype UI to switch sites with unsaved-change confirmation.

Adds an AssetContainer setting to enable/disable localizable metadata per container, plus a new statamic:assets:migrate-localizable command and tests covering persistence, migration behavior, and cycle-safe origin resolution.

Written by Cursor Bugbot for commit e62ea36. This will update automatically on new commits. Configure here.

@daun
Copy link
Copy Markdown
Contributor

daun commented Feb 13, 2026

Yay 🎉 May I suggest a tab interface for switching between localizations? We've tried a few custom iterations and all of our clients preferred this type of interface for switching between localizations:

Screenshot 2026-02-13 at 20 46 01

@jasonvarga
Copy link
Copy Markdown
Member

That'll work when you have a couple of sites, but once you have more than a few it'll fall apart quickly. We will note that though!

@daun
Copy link
Copy Markdown
Contributor

daun commented Feb 13, 2026

Yeah. Good point. Maybe that's a case for if (sites.length > 3) or so. In my experience, it's either 2-3 sites or 11 sites.

@jackmcdade
Copy link
Copy Markdown
Member Author

Yeah. Good point. Maybe that's a case for if (sites.length > 3) or so. In my experience, it's either 2-3 sites or 11 sites.

Yeah maybe — though for now I'd rather keep things simple and just get it working first. A select box works everywhere. :)

`localizationData()` calls `origin()->values()` when `hasOrigin()` is true. With a cyclic sites origin map, this enters recursive origin resolution via `values()` and can loop indefinitely while serializing CP asset responses.
When saving a localized asset (e.g. rename/move), hydrate() was filling $data with origin-merged values and meta() was writing that merged set into data.{locale}, turning inherited fields into explicit overrides.

Add localizedDataForPersistence() to only persist explicit localized
data when no mutation occurred. If $data is unchanged from the
hydrated view and removedData is empty, keep the existing explicit
localized bucket as-is.
@jackmcdade jackmcdade marked this pull request as ready for review February 14, 2026 03:59
Show error state and Retry when the asset request fails instead of
rendering with null asset and crashing on asset.path.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

if (JSON.stringify(values) === JSON.stringify(updated)) {
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load() no longer returns promise, breaking await

Medium Severity

The load() method no longer returns the axios promise (the return keyword was removed), but handleCropReplaced() calls await this.load(). Since load() now returns undefined, the await resolves immediately, causing bustAndReloadImageCaches to fire before the asset data has actually reloaded.

Additional Locations (1)
Fix in Cursor Fix in Web

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.

3 participants