DynamicEntityReferenceItem::getTargetTypes() requires 'entity_type_ids' setting array to be in the format: entity_type_id => entity_type_id because it is intersecting against keys. But DER has different definitions of this setting spread through its code.
Examples
Numeric (auto) IDs (DynamicEntityReferenceRelationshipTest):
'settings' => array(
'exclude_entity_types' => FALSE,
'entity_type_ids' => array(
'entity_test',
'entity_test_mul',
),
),
Key/Value Mirroring (DynamicEntityReferenceWidgetTest):
'settings' => array(
'exclude_entity_types' => FALSE,
'entity_type_ids' => array(
'node' => 'node',
),
),
PHPDoc for getTargetTypes also mentions a return value of string[], which would should be an array of entity type IDs. However it actually returns Entity Type Labels keyed by Entity Type IDs.
I propose getTargetTypes should just diff/intersect against values. Keys should have no importance.
Comments
Comment #2
dpiUse values instead of keys.
If this route is taken I would suggest that we remove existing key IDs in existing
entity_type_idsdefinitions.Comment #4
dpiComment #5
dpiComment #6
dpiLets give this a shot.
Comment #9
dpiAll DER tests pass locally on beta14. Testbot is failing due to #2553915: Update class extend of DynamicEntityReferenceRelationshipTest.
Comment #10
jibranI think this was the reason it returns the KV but I can see this is the only place where we are doing this so I think this patch is an overall improvement. I'll commit this once HEAD is green.
Comment #14
jibranPushed to 8.x-1.x. Thanks for the patch.