Skip to content

[6.x] Add icons to the Dictionary fieldtype - #15181

Open
edalzell wants to merge 2 commits into
statamic:6.xfrom
edalzell:feature/dictionary-item-icons
Open

[6.x] Add icons to the Dictionary fieldtype#15181
edalzell wants to merge 2 commits into
statamic:6.xfrom
edalzell:feature/dictionary-item-icons

Conversation

@edalzell

Copy link
Copy Markdown
Contributor

Was porting a v5 site to v6 and ran into a custom fieldtype that was essentially a dictionary field with icons.

This allows icons to be added to each item.

Reserve an icon key on Statamic\Dictionaries\Item, mirroring label: it's
excluded from data() but still present in extra()/toArray(). BasicDictionary
skips it when matching search queries so raw SVG blobs aren't scanned. The
dictionary fieldtype's options endpoint and preload data now surface the
icon (a Statamic icon name or raw <svg> string) when one is set, omitting
the key entirely otherwise.
Icon.vue already renders either a registered icon name or a raw <svg>
string, so surface an option's icon (dropdown rows, single-select label,
and multi-select badges) wherever it's provided. HasInputOptions now
preserves the icon key when normalizing object-shaped options, and
DictionaryFieldtype carries it through selectedOptions so it survives the
round trip through selectedOptionData.
@edalzell
edalzell marked this pull request as draft August 13, 2026 01:14
@edalzell edalzell changed the title Add icons to the Dictionary fieldtype [6.x] Add icons to the Dictionary fieldtype Aug 13, 2026
@edalzell
edalzell marked this pull request as ready for review August 13, 2026 01:37
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.

1 participant