Needs work
Project:
Inline Entity Form
Version:
3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Mar 2016 at 07:45 UTC
Updated:
29 May 2025 at 19:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bojanz commentedOur default use case assumes that there will be too many entities to load at once. So the autocomplete must stay.
However, we also must make that dialog overridable, so that you can add that behavior yourself if you want.
That's going to be a post-beta1 task.
Comment #3
slashrsm commentedLet me just mentions that it is possible to replace autocomplete with an Entity browser. :)
Comment #4
Mirroar commentedTaking the liberty to rename the issue. I agree with bojanz that the dialog needs to be overridable, that would help me out in one of my current projects, where I would like to replace the autocomplete with a custom form.
I'd suggest using plugins for this, either a new Plugin type, or even the default FieldWidget plugins (minus IEF itself).
Comment #5
Mirroar commentedI know we're still in alpha, but I'd be very interested in getting something working for replacing the default autocomplete. I know entity_browser already replaces it by using some funky for alter hooks (`hook_inline_entity_form_reference_form_alter`), overwriting validate callbacks, etc. While that works, it seems like preddy bad developer experience, and I see trouble down the line once multiple modules try altering that form.
So I'd much rather have this solved through Plugins and was wondering whether there were any concrete plans / ideas for this already. I'm willing and able to put some time into this, but I don't want to just go off in a direction I deem appropriate when the maintainers of IEF might have different plans. Therefore I'd be happy about some pointers, otherwise I'll just come back with a patch if I get something decent working.
Comment #6
tkoleary commented+1 to this issue.
It would be a far better experience if, for example, multiple value autocompletes could use Chosen or Select2 libraries.
Comment #7
bradjones1As a proof of concept, this is rather easy to do with a form alter on the widget:
You would obviously want to focus this on just the parent forms that you would want to adjust, so as not to make the alter site-wide, but it's pretty straightforward.
Comment #8
gordon commentedPlugin's would be great here but we not need to reinvent the wheel as there is already plugins for entity reference fields. We just need to use the FieldWidget plugin for entity reference fields and make sure we do not include the Inline Entity Form widget, or things will get interesting.
Comment #9
thejimbirch commentedThanks @bradjones1! Your hook in #7 works great.
Comment #10
geek-merlinFor us, the code in #7 does not work anymore, as since #2830328: Required IEF forms for existing entities don't work \Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormComplex::extractFormValues has the assumption "autocomplete" hardcoded in it.
As much as i love pluginification, i think a first approach might add a autocomplete / select setting and then let's see how to proceed.
Comment #11
geek-merlinPatch flying in with a first shot at this.
EDIT: This patch is onto #2673548: Prioritize 'add existing' in nested entity creation UX to prevent duplication., so if that one gets in first, we already have the rebase...
Comment #12
geek-merlinPatch flying in.
Comment #14
geek-merlinForgot updating schema.yml. Here we go.
Comment #16
geek-merlinAh OK, removed some erroneous $this from inline_entity_form_extract_autocomplete().
(Ideally all that functions should go into a class, and be left as BC proxies, but that's a followup.)
Comment #17
nimoatwoodwayWorks like charm! Tested with Drupal 8.7.6 and Inline entity form version 8.x-1.0-rc2
Comment #18
geek-merlinSo RTBC if maintainer has no objections.
Comment #19
david.qdoscc commentedPatch applies cleanly to 8.x-1.0-rc2, but does not apply to 8.x-1.x-dev
Comment #20
geek-merlinSo this needs rebase. Also a test would be nice.
Comment #21
geek-merlinComment #22
the_glitch commentedPatch doesn't apply to 8.x-1.x-dev
Comment #23
rithesh bk commentedcurrently working on it ....
Comment #24
rithesh bk commentedPlease find the updated patch .......
Comment #25
the_glitch commentedPatch #24 works. Thank you Rithesh.
Comment #26
dhirendra.mishra commented+1 for RTBC.
Comment #27
geek-merlinThis is great. To keep this maintainable we need a test though.
Just a very simple: "When we select a select widget, we get a select widget. When we select autocomplete, we get autocomplete."
Comment #28
nodecode commentedIt works. Select the select widget and that's what you get. Select the autocomplete widget and hey there's an autocomplete widget.
Comment #29
dwwStill needs (automated) tests written, not just manual testing.
Thanks,
-Derek
Comment #30
tipmislePatch in #24 works for me with the latest dev branch. Awesome work.
Comment #31
zvonimirrPatch #24 works with Drupal 9.
Comment #32
geek-merlinThe related issue reports double-escaping of this patch's select list items.
Crosslinking it, but as it looks more like an upstream issue than this patch's fault, let's keep it separate for now.
Comment #33
geek-merlinAs the_glitch (crediting here) noted in #3182415: [With patch 2683125-24] Add-existing-item select list double escaped (special characters broken), this breaks with special characters.
Whoever writes TESTS: Please include special characters.
Idea how to fix: In \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase::getOptions i found this that should fix special characters:
which boils down to something like
Comment #34
w01f commented...
Comment #35
le72Why this is not included in the latest release? :-(
Comment #36
dv-vc commentedPatch no longer applies cleanly to RC12 or dev
Comment #38
goodmood commentedAdding re-rolled patch to apply over RC12 version
Comment #39
geek-merlin> Why this is not included in the latest release? :-(
I like the feature. Code looks good overall, but it needs tests.
There are many tests in the module, that can be extended.
Comment #40
kopeboyUp
Comment #41
arunkumarkThe feature is super cool for the IEF.
The patch is not applied with the latest version of the IEF module. I have rerolled the patch #38. Attached patch to,
Comment #42
podarok#41 needs reroll
Comment #45
jennakoo commentedRerolled patch #41 for Drupal 10
Comment #47
podarok#45 is in
tnx
Comment #50
dqdRegarding #3401656: Clean up problematic 2.x branch we need to tackle issues possibly somewhat got under the mist of the latest branch confusion. And since this FR here has been hijacked for the now-closed 2.x branch in the middle of its progress for the 1.x branch, I do not know if it has ever landed in the 1.x branch. Let me link this issue to the clean-up issue and let me set version worked on back to 8.x-1.x-dev for a possible re-roll. Maintainers need to re-open if required.
Latest patch possibly useful to get forward in 1.x branch is in comment #41.
Tested on latest ief 8.x dev:
Comment #51
geek-merlinBulk reopen.
Comment #52
geek-merlinAs tagged and re-stated in #33 ands #39, this needs a test.
Comment #53
dwwStill needs tests, but here's a reroll of #41 that applies to both 8.x-1.x and 3.x branches.
Comment #54
dwwThe settings summary was previously buggy, since it would talk about the autocomplete matching operator even when set to use the select widget. This cleans that up and makes the summary more verbose.
Comment #55
dwwyeah, seems the automated tests are kinda broken until #3410055: Adopt GitlabCi is merged. But here's an updated patch that, once the latest code from #3410055 is applied, gives me passing tests locally...
Comment #56
dwwE.g. here's #55 and the latest code from #3410055 in 1 patch. This should be green. 🤞🙏
Comment #57
geek-merlinComment #58
dwwRe-roll now that #3410055: Adopt GitlabCi landed. Also, removing the bogus config schema change for the simple widget. This is only a new setting for the complex widget.
Still needs tests of the new feature, so leaving NW, although the existing tests should be green at last.
Comment #59
gaurav_manerkar commentedHello,
Callback added for
#ief_extract_values_callbackdoesn't trigger for all the items when parent field contains cardinality > 1.I am facing the problem on v1 for IEF. The same problem may be present on v3 as well.
Comment #60
flefle commentedUpdated Patch for 3.0RC17
Comment #61
mlncn commentedComment #62
kopeboyYep, patch in #60 worked, and didn't seem to break anything! Thank you all!
Comment #63
geek-merlinDrupalorg does not test patches anymore. Can someone create a MR of it?
Comment #67
arunkumarkCreated MR for patch.
Comment #68
geek-merlinThanks for the MR! Which has test failures, so NW for that.
https://git.drupalcode.org/issue/inline_entity_form-2683125/-/jobs/3297570
Comment #70
pameeela commentedRe-rolled the branch and attaching a patch file to use for this. It's working for us, but I haven't looked into the test fails so still NW.