Updated: Comment #6
Problem/Motivation
Comment field 'field_id' is a surrogate field that holds ({entity_type}__{field_name}
) 'node__comment' data so it can't be user as ER field as is.
We have to store the value in that form because comment module uses that name as bundle for comment entity but field instance can't have a dot in it's name, it was decided in #731724: Convert comment settings into a field to make them work with CMI and non-node entities
Proposed resolution
introduce field item and value class to properly return value.
Remaining tasks
Find solution and fix.
User interface changes
no
API changes
tbd
Original report by @amateescu
I guess this wasn't done in the first place because entity reference couldn't reference config entity types, but now it does so we can convert this field.
Comment | File | Size | Author |
---|---|---|---|
#15 | 2149859-comment-field-id-15.patch | 3.6 KB | andypost |
#13 | 2149859-comment-field-id-13.patch | 4.47 KB | andypost |
#13 | interdiff.txt | 1.93 KB | andypost |
#8 | 2149859-comment-field_id-7.patch | 2.34 KB | andypost |
Comments
Comment #1
larowlanThis will make a lot of code cleaner
Comment #2
amateescu CreditAttribution: amateescu commentedForgot to say that I'd prefer this to wait for #2112239: Convert base field and property definitions.
Comment #3
BerdirComment #4
klausiDuplicate of #2181593: Convert entity bundle base fields to entity reference.
Comment #5
andypostActive again because #2181593-26: Convert entity bundle base fields to entity reference
Also closed #2197723: Comment::getFieldId() should return actual field ID as duplicate
Comment #6
andypostComment #7
andypostupdated summary about 'field_id' is used as bundle for comment entity
Comment #8
andypostlet's try fix in constructor
Comment #9
andypostfix bug
Comment #10
andypostadded related issues
Comment #13
andypostAnother round
Comment #15
andypostSuppose the issue should be renamed to "rename confusing field_id to bundle" - there's no way to make it ER.
Also patch just cleans up a bit code, core needs to provide a right approach to create comments - by providing entity type and field name.
Main purpose of the patch:
1) remove ER definition - a part of #2002158: Convert form validation of comments to entity validation
2) change the logic to get field name.
Probably one day we could make 'entity_type' a required field...
Details:
At least
EntiyDisplayBase
calls_field_create_entity_from_ids()
to create comment entity for internal use, so we still can't make "entity_type" field required.I've checked that core does not trying to exlode "field_id" value to get entity type ID - so for now comment module is safe.
Comment #17
andypostThe problem here that I was trying to convert to
field_id
that actually a reference to field instance, that generated when comment field is bound to entity.Comment #18
andypost#2233157: Make the comment entity_id be a reference field is commited so we can close this one
Comment #19
BerdirThis issue is about the field_id, the other one was about the entity_id, not the same thing...
Comment #20
andypostsure
Comment #21
larowlanfield_id is gone now, we have comment_type instead (which is an ER field)