entity_ref field type performs ajax rebuilds in its "instance settings (sub)form".
In order to do so, ConfigurableEntityReferenceItem::instanceSettingsForm() currently needs to fetch $form_state['instance'] instead of using the usual APIs for the method ($this->getFieldSetting(), $this->getFieldDefinition()), because in current HEAD, those are "the official state of the $instance as it exists in the config store", not "the $instance being edited / rebuilt".
That is because Field UI's FieldEditForm and FieldIstanceEditForm build a FieldItem object in order to call its settingsForm() / instanceSettingsForm() method, but this FieldItem object is based on the $field / $instance from config.
Instead, this FieldItem should be built on the $form_state['instance'] being iteratively built.
Comments
Comment #1
yched CreditAttribution: yched commentedPatch coming, hitting a few roadblocks :-)
Comment #2
swentel CreditAttribution: swentel commentedTagging, marked #2084371: Settings form does not work when moving from hidden to content as a dupe of this.
- edit - amateescu reopened it, just to be sure
Comment #4
yched CreditAttribution: yched commentedHm, the causes might be similar, but those are different code areas in separare forms, so I'd like to keep this one focused on the "field / instance settings forms". +1 on keeping two separate issues ;-)
Comment #5
amateescu CreditAttribution: amateescu commentedI just went over those roadblocks after writing a patch to convert the field_config edit form to an entity form. I think I managed to overcome them properly in #2448357: Config entity forms need to have access to an updated entity object at all times.
Comment #6
amateescu CreditAttribution: amateescu commentedBTW, the two issues to convert "field storage" edit and "field edit" forms to be entity forms are here:
#2446869: Convert the "Field storage edit" form to an actual entity form
#2448503: Convert the "Field edit" form to an actual entity form
Comment #7
amateescu CreditAttribution: amateescu commented#2448357: Config entity forms need to have access to an updated entity object at all times is in and the other two have (mostly) working patches, so I think it's safe to close this now :)
Comment #8
yched CreditAttribution: yched commentedawesome