Closed (fixed)
Project:
Inline Entity Form
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Dec 2012 at 19:14 UTC
Updated:
11 Sep 2022 at 10:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedCan you edit your reference field and just select only one allowed bundle?
That will cause the bundle dropdown to disappear.
Comment #2
hanspln commentedUnder entity selection, the "Target Bundles" disappears when you choose to select values from a view instead of "Simple (with optional filter by bundle)"
I have enabled both "Add new" and "add existing", and it's because of the "add existing" I need a view to filter on "by logged in user".
Comment #3
dwalker51 commentedI have the same issue.
Comment #4
PedroMiguel commentedI have also the same need
Comment #5
rob c commentedI have the same case as #2. After some digging, it does seem to work when i filter per view and hard code something like this as a test in i_e_f.module file at line 334 +/- inside the inline_entity_form_settings() function inside the elseif ($field['type'] == 'entityreference') { ... } below everything else in that function.
A bit below this line i read a foreach ($info['bundles'].....)... that 'bundles' isn't set if you use my attempt, so this should just work. At least, the select is gone, and the content displays just fine, filtering is done via Views anyway.
edit: after testing some with the cer module (Corresponding entity references), i notice that when i select a view for selecting entities, cer will stop working. So we do need a bundle and this is not enough.
Comment #6
westie commented@Rob C Sounds like a good idea to me although I think people may want to select which bundles can be created rather than hard coding.
A views is being used to filter what can be referenced, it should also be responsible for defining which bundles may be created.
I have applied the attached patch for my use case (Taxonomy Terms) (but should be easy to convert for all entity types) and this allows bundles to be selected from within views using the "Taxonomy term: Vocabulary" filter, the selection made here will be reflected in the node edit forms.
Once reviewed if people think the approach used is good then I can roll new patches for node content types etc.
Comment #7
mtoscano commentedI don't have a user case for Taxonomy, but if you produce a patch for node content type I will be happy to test and report.
I think this feature is important.
Thanks
Comment #8
dave reidHere's a patch that integrates with node views to limit the bundle selection field.
Comment #9
dave reidRevised patch #8 to be correct for bundle values.
Comment #10
mtoscano commentedThis patch does not apply anymore against 7.x-1.5 and this feature has not been implement yet.
That means there is no way to make sure that if using a view for the entity selection, only the bundles which are returned by the view are available to create.
Anyone able to port this patch against latest dev version or point to another working patch?
Thanks
Comment #11
mtoscano commentedComment #12
whthat commentedUpdate patch to work with 7.x-1.5
Comment #13
whthat commentedComment #14
freality commentedThe previously attached patches did not work for me because I was referencing entity types other than node. This patch simply tests if the handler is a Entity Reference Selection Handler, and clears the
$settings['create_bundles']array.I haven't found any ill affects in this approach. EntityReference doesn't require a bundle.
This logic should probably be in
inline_entity_form_settings. But I could not decipher the impact of that change. If agreed, I can refactor.Comment #15
vaccinemedia commentedPatch #12 works a treat :)
Comment #16
pmchristensen commentedCorrected patch file - changed paths to files to be from module folder instead of from drupal root folder.
Comment #17
nevergone#16 is works well!
Comment #18
eneko1907 commented#16 works for me too - thanks for the update
Comment #19
sumi commented#16 works for me as well.
Comment #20
decipheredPatch works a charm, and while it's a bit of a pain in the butt to have to load and execute a view just to get the bundle filter values, it is a seamless user experience and fixes the issue nicely.
Comment #21
bojanz commentedI can't commit a patch that works only for nodes.
Get the entity keys, search for the bundle key, make it generic.
Comment #22
feyp commentedAttached is a patch, that uses the same approach as #16, but should work for any entity. I also added a check of contextual filters, if no filter on the bundle is present.
Comment #23
Mołot commentedPatch by FeyP Worked like a charm for me.
Comment #24
Mołot commentedComment #25
jweirather commentedPlease ignore, posted to the wrong thread.
Comment #26
jweirather commentedWorks for me as of the IEF 7.x-1.6 release (dev) as well. Any chance of getting this committed?
The recent update to 1.6 caused the issue for me again and I had to calm the masses, find and reapply the patch.
Thanks all!
Comment #27
LonitaD commentedPatch in #1872316-22: Can't select a default bundle when using entity reference views works great for me as well. Will this be committed sometime in the future?
Comment #28
nevergone#1872316-22: Can't select a default bundle when using entity reference views Tested and works well! :)
Comment #29
morsokWorked for me too, i'd love to see this commited :)
Comment #30
eneko1907 commentedrevised patch at #22 Works for me too - would be great to see this patch moved to dev. THANKS!
Comment #31
sch2 commented#22 worked nicely. Thanks! I'd also like to see it committed to dev
Comment #32
gilsbert commented#22 is working. May it be commited?
Comment #33
friera commented#22 is working. Thanks!
Comment #34
hkirsman commentedSame in D8 - https://www.drupal.org/node/2729333
Comment #35
nessunluogo commented#22 solved my problem. Will it be committed?
Comment #36
goron commentedConfirming also that this works and should be committed
Comment #37
prografr commented#22 also worked for me.. thanks alo @FeyP
Comment #38
ray17n commented#22 also works for me. Thanks.
Comment #39
ashedryden commented#22 tested and works on 7.x-1.8
Comment #40
tuchoThe patch on #22 works for me as well.
Comment #41
alfthecat commented#22 works like a charm. Thanks!
Comment #42
whthat commentedApplies to 7.x-1.9 cleanly and still relevant
Comment #43
smurfxx commented#22 works!
Comment #45
ram4nd commented