Updated: Comment #N
Problem/Motivation
All field with field types provided by core (core/lib/Drupal/Core/Field/Plugin/Field/FieldType) are gone after cache rebuild.
Steps to reproduce
- Create a Entity Reference Field (field_foo)
- Goto admin/config/development/performance and clear the cache
- Go back to the "Manage fields" of the entity type
- The Entity Reference Field is not visible
I did some debugging and found the root cause of this problem.
The field.field.node.field_foo.yml file contains to wrong properties.
- module: Core
- active: false
During cache rebuild the field_sync_field_status() function is called. field_sync_field_status() writes directly to CMI and disables the field because the field definition contains "provider = Core". Because the FieldItem class is provided by core. field_sync_field_status/() uses provider as module name and "Core" is no valid and loaded module.
All field types provieded by core have this problem. Its reproducible with boolean, date, email, ER, Float etc..
Proposed resolution
Remaining tasks
User interface changes
API changes
Related Issues
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | field-definition-provider-2131765-1.patch | 750 bytes | webflo |
Comments
Comment #1
webflo commentedUpdated issue summary.
Comment #2
webflo commentedAttached file. I use the following patch in my local env to fix entity reference fields.
Comment #3
dawehnerOne problem is that field.views.inc relies kind of that you can execute hooks like that:
This would limit us from being able to specify specific views integration for all "Core" fields. I know that at least entity references will certainly need one.
Comment #4
swentel commentedInteresting. Text module doesn't have the problem though ...
- edit - so yeah, and it's normal that this works fine since it doesn't extend on a field item from core ..
Comment #5
swentel commentedRelated: #2115291: Field types must use as provider its own module instead of Core when are defined in hook_field_info_alter() - has the same patch as well, but doesn't solve it for all field types.
Comment #6
berdirIt does now I think.
However, if we want to do #2052135: Determine how to deal with field types used in base fields in core entities, then we should probably make Core a valid special case of being always active (I think the active stuff is going anyway?).
Note that I really think there shouldn't be "Core" (because that's not a component), instead, I'd like to have something like "core.field", or "core/field" or something like that. Maybe we can already consider that, or at least have a test that will make sure that we have to update this..
Comment #7
swentel commentedAlso related: #1503314: Remove the concept of active / inactive (field types, storage) from Field API which would make this a non problem.
Comment #8
catchI just committed [##2115291].
Don't think we should make 'Core' a special-case, better to not rely on that as much as possible.
Between that and removing inactive, I think we can mark this duplicate. But please re-open if I missed something.