To reproduce this, add an entity reference field to an entity and have it target nodes of some bundle. You should start to see the error on the field edit page, and you will also see it on the create/edit form that has the IEF widget.
The problem seems to be that IEF is passing the bundle name into the $entity argument of entity_access when in fact this argument expects either NULL or a real entity.
This happens with Entity module version 7.x-1.1. Patch is attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | inline_entity_form-entity_access-1990064-5.patch | 1.12 KB | mile23 |
| #4 | inline_entity_form-entity_access-1990064-4.patch | 896 bytes | JvE |
| #2 | 1990064-fix-access-notice.patch | 664 bytes | dpolant |
| fix_access_notice.patch | 489 bytes | dpolant |
Comments
Comment #1
dave reidWe're actually pretty sure this is a bug in entity's access system: #1780646: entity_access() fails to check node type specific create access
Comment #2
dpolant commentedYou are right. The new patch that creates a special case for nodes and just calls node_access instead of entity_access.
Its hard to make this fix generic for all entities because who knows how their entity access callbacks work. I think the best we can do now is just to make this work for nodes. In theory the individual entity modules can craft their entity access callbacks to accept a string for "create" checks like node_access does, and thus the entity_access call in IEF should work for them.
Not sure I like this ad-hoc approach, but short of creating some kind of hook/plugin structure through which modules that want to use IEF can say which way their access function works, there isn't a whole lot we can do. Just fixing node support seems like the best thing for IEF right now, until the community decides on a consistent approach for doing "create" access checks.
Comment #3
bojanz commentedI am not interested in committing a workaround for what is obviously an Entity API issue (and which already has patches).
Still, keeping the issue open for now.
Comment #4
JvE commentedGood thing you did.
Apparently the bug is in Inline Entity Form after all now that fago documented the 'create' case in #1780646: entity_access() fails to check node type specific create access:
Pretty much exactly what's already in place for commerce entities.
Comment #5
mile23JvE: That patch doesn't apply cleanly.
Here's a re-do. Apologies for not adding tests.
Comment #6
bojanz commentedOkay, committed, now it's up to Entity API to fix its bug :)
Comment #8
RobertoGA commentedI'm using 7.x-1.3 version of Inline Entity Form where this patch has been applied and the errors continue appearing.
Apparently this error is not from IEF, is from Entity module. My issue has been solved at this entry appling the last patch at this moment:
1780646-202-entity-node-access.patch
I apologize for open the issue, I'm going to close it.