Problem/Motivation
Node preview was broken when using a field collection and after coming back from the preview (of a node being added) the widget has lost its values. See #2500993: Entity reference value gets removed when using preview and not saving IEF (and duplicate Field Collection issue #2689499: Previewing node loses field collection entities). But now, if you apply #2500993: Entity reference value gets removed when using preview and not saving IEF, when returning from a new node preview, the "Remove" and "Edit" buttons both are disappearing.
The reason for this misbehaviour:
- The access to buttons is deferred to
FieldCollectionItemAccessControlHandler::checkAccess
- The access is granted if the host entity allows the access. If the host entity doesn't exist, the access is forbidden.
- But after previewing a new node the field_collection_item entities are already created but the host is not yet created (we are on
/node/add/some-node-type
), thus the access is forbidden and the buttons are not displayed.
Proposed resolution
Allow the access to field_collection_item entity when the field knows already the type of its host entity. This means that field_collection_item has already set its host via ::setHostEntity()
.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2749361-2.patch | 2.53 KB | claudiu.cristea |
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
bircherthe patch in #2 works for us.
Comment #4
jmuzz CreditAttribution: jmuzz commented8.x-2.x is no longer being developed or supported.