Skip to content

Normalize stored SVG icon IDs when switching between one and several … - #42

Merged
lphoumpakka merged 4 commits into
masterfrom
fix-multi-sprite-master
Sep 7, 2026
Merged

Normalize stored SVG icon IDs when switching between one and several …#42
lphoumpakka merged 4 commits into
masterfrom
fix-multi-sprite-master

Conversation

@lphoumpakka

@lphoumpakka lphoumpakka commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

…sprites


Note

Medium Risk
Stored field values change format on save and frontend/theme code that assumed bare ids with a single sprite may need to handle sprite#symbol; admin-only normalization depends on parsing all sprites when legacy values load.

Overview
Release 2.3.0 fixes empty Select2 selections when older data still stores bare symbol ids (icon-alert) while the picker now always exposes sprite.svg#icon-id option values.

Sprite options from parse_svg() always use the basename(sprite)#symbol id (the single-sprite “bare id only” branch is removed). load_value and update_value run normalize_icon_value(), which maps legacy bare strings to the matching sprite option via a memoized symbol→option map (first registered sprite wins); numeric media attachment ids are unchanged. Values are rewritten to the canonical form on save.

Version metadata and changelog are updated; minor PHPCS ignores on ACF subclass constructors.

Reviewed by Cursor Bugbot for commit 0e04eb5. Bugbot is set up for automated code reviews on this repo. Configure here.

@lphoumpakka
lphoumpakka requested a review from petitphp September 2, 2026 08:20
herewithme
herewithme previously approved these changes Sep 4, 2026
@lphoumpakka
lphoumpakka merged commit d949fd1 into master Sep 7, 2026
2 checks passed
@lphoumpakka
lphoumpakka deleted the fix-multi-sprite-master branch September 7, 2026 07:27
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