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:

  1. The access to buttons is deferred to FieldCollectionItemAccessControlHandler::checkAccess
  2. The access is granted if the host entity allows the access. If the host entity doesn't exist, the access is forbidden.
  3. 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.

CommentFileSizeAuthor
#2 2749361-2.patch2.53 KBclaudiu.cristea
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.53 KB

Patch.

bircher’s picture

Status: Needs review » Reviewed & tested by the community

the patch in #2 works for us.

jmuzz’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

8.x-2.x is no longer being developed or supported.