Problem/Motivation
It is possible for recipes to ship default content for Experience Builder. That default content can contain references to files/images, as entity references to media. But those references are buried in Experience Builder's input data structures, and although those references are powered by entity reference fields, they are encoded in such a way that our default content importer will not know how to handle them (we don't support denormalization on import).
Proposed resolution
It is an unfortunate deficiency that entity reference field items cannot refer to an entity by UUID. I understand that we store the serial integer (or string) target_id
for, presumably, database efficiency reasons -- and that makes sense. But it would greatly improve the ability to use default content -- and unblock site template functionality -- if entity reference items had a computed target_uuid
property:
// Internally looks up the media item with that UUID and sets the `target_id` property accordingly.
$node->field_hero_image->target_uuid = 'abcdef-123456';
// Loads the entity from its `target_id` property and returns its UUID.
echo $node->field_hero_image->target_uuid;
For simplicity of implementation, the target_id
should not be stored -- the data layer remains exactly the same.
User interface changes
None.
Introduced terminology
None.
API changes
All entity reference items will receive a new virtual property.
Data model changes
Not really.
Release notes snippet
TBD.