Updated: Comment #0
When a field or field instance gets saved or loaded there's no straight way for the field item class to interact and apply some processing on settings before they are saved or loaded.
A typical case is the image field. In that case some settings, like default image width and height, need processing. Those settings computations are performed now in a inappropriate place, in image_entity_presave()
. See image_entity_presave().
- Define new processSettings()
/ processInstanceSettings()
method in \Drupal\Core\Field\ConfigFieldItemInterface
and let field item implementations to react before saving field/instance settings.
- Provide base implementations that just do "merge default settings"
Call the methods in the places where we currently do the "merge default settings" thing:
- before saving field/instance settings (in Field/FieldInstance::preSave(), once
#2020895: Move save() / delete() logic in Field / FieldInstance to [pre|post]Save(), [pre|post]Delete() β
finally gets committed),
- and after loading them (FieldInfo::prepareField() / prepareInstance())
- This is not only about configurable fields, base fields will need to run those as well.
Will probably be in EntityManager::getFieldDefinitions() after
#2076445: Make sure language codes for original field values always match entity language regardless of field translatability β
lands
N/A
New method in FieldItemInterface.
Postponed: needs info
11.0 π₯
field system
To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.