Skip to content

[6.x] Allow fieldtypes to have an "icon" config field - #15444

Merged
jasonvarga merged 1 commit into
6.xfrom
fix/fieldtype-icon-config-collision
Sep 11, 2026
Merged

[6.x] Allow fieldtypes to have an "icon" config field#15444
jasonvarga merged 1 commit into
6.xfrom
fix/fieldtype-icon-config-collision

Conversation

@jasonvarga

@jasonvarga jasonvarga commented Sep 10, 2026

Copy link
Copy Markdown
Member

A fieldtype could not have a config field handled icon — the value was silently destroyed.

FieldtypeSelector.createField() built a single flat object containing both the fieldtype's CP icon (used for the glyph on the field row) and the default value for each of its config fields, merged with Object.assign(defaults, field). For a fieldtype declaring an icon config field, the CP icon won, so the config default was clobbered before the field was even created. Fields.vue then spread that whole object into config, and the bogus value followed the field through the settings form and into the save request.

FieldTransformer::inlineTabField() compensated by unconditionally rejecting icon from every field config (#9372), which is what made an icon config field impossible to save.

The icon is now returned alongside the config instead of inside it, so the two can no longer collide. It stays where it was already being used — the top level of the field object, which is also where FieldTransformer::toVue() puts it when reading a blueprint back. Nothing reads config.icon.

With the client no longer injecting it, the strip in FieldTransformer is gone too. An icon key is now treated like any other unrecognised config key, which is the behaviour every other manually added key already had.

Needed for #15368

The fieldtype selector built a single flat object containing both the
fieldtype's CP icon and the defaults for each of its config fields. A
fieldtype declaring a config field handled "icon" would have its default
overwritten by the CP icon, and that value then followed the field into
its config, through the settings form, and on to the save request.

FieldTransformer worked around this by unconditionally stripping "icon"
from every field config, which made an "icon" config field impossible to
save at all.

The icon is now kept alongside the config rather than inside it, so it
can no longer collide, and the strip is no longer needed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit 1840fe2 into 6.x Sep 11, 2026
66 checks passed
@jasonvarga
jasonvarga deleted the fix/fieldtype-icon-config-collision branch September 11, 2026 14:00
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