Motivation
Current default output for an entity reference field, like article tags, is that:
<div slot="tags">
<field-entity-reference target-id="1" slot="default"></field-entity-reference>
</div>Proposed resolution
Improve to something like
<field-entity-reference slot="tags" href="/the/canonical/link" label="the-entity-label"></field-entity-reference>
<field-entity-reference slot="tags" href="/the/canonical/link2" label="the-entity-label2"></field-entity-reference>
This will imply a BC change for everyone relying on the default custom element processor.
Issue fork custom_elements-3190604
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoComment #4
fagoDepending on #3190611: CustomElement::setSlotFromNestedElements should never add wrapping elements this MR implements this.
Comment #5
fagoI improved the code bit more, now it outputs entity references by default using a simple link in the entity slot:
Example output
I think this is fine as default, everything more will need dedicated processors with suiting output anyway.
Comment #6
fagoand further improved defaults if entities are not accessible, so the link is not output. This should also fix tests.
Comment #7
fagoshould be all good now, thus merged.