Closed (fixed)
Project:
Inline Entity Form
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2015 at 07:24 UTC
Updated:
23 Feb 2020 at 11:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
floretan commentedHere's a patch that fixes this issue. It uses the fact that when a field doesn't use bundles,
$settings['handler_settings']['target_bundles']is an empty array, but when a field uses bundles and none are set (for example, because the user interrupted the field creation workflow before entering the field settings)$settings['handler_settings']['target_bundles']is undefined.Maybe we could get more reliable information by loading information from the entity type, but I'm not sure it's worth the overhead.
The example with the user reference field is just to give an easy way to replicate the bug, there are definitely more realistic use cases (for me, it's a custom entity that needs to be edited from the context of another one).
Comment #2
slashrsm commentedThis was already discussed in https://github.com/webflo/inline_entity_form/pull/10/files. Main concern in this PR was assuming entity type == bundle for entity types without bundles. I think it is safe to assume that as we have this assumption in other places around core too.
Looks OK to me.
Comment #3
dawehnerI think this patch is a little bit wrong. It is a false assumption that entity type is always the key.
No target bundles actually mean all bundles.
Comment #4
amateescu commented"No allowed..." :P
Other looks good to me, the comment cad be fixed on commit :)
Comment #5
amateescu commentedOops, that was a bit hasty. Some manual testing shows that the patch in #3 doesn't work all the way :)
Comment #6
dawehnerThere we go. Did some similar change to
Comment #7
amateescu commentedCool, that looks better.
Comment #9
bojanz commentedMoved the logic to a helper method, since it's repeating.
Credit goes to dawehner for figuring out the correct logic.
Thanks, everyone.
EDIT: Forgot to squash. Oh, well.
Comment #11
xandeadx commentedAgain. If i create reference field to user (entity without bundles) and set widget "Inline Entity Form - Simple", when form render empty fieldset wihtout widget.