Problem/Motivation
inline_entity_form_reference_form ("Use existing" entity functionality) uses a textfield for autocomplete. I think we can refactor this part and use the new autocomplete element from core.
Core change record for more info: http://drupal.org/node/2418529.
Proposed resolution
Replace textfield for autocomplete in "Use existing" part of IEF.
To get to the field we're changing here:
- Create entity reference field on any node type
- Go to "Manage form display" page
- Find newly created field
- Use "Inline entity form complex" widget
- Configure IEF complex to allow referencing existing entities
- Navigate to node add page for this type
- Click "Add existing" button
- Autocomplete field appears
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | interdiff.txt | 2.47 KB | thenchev |
| #24 | use_autocomplete-2490914-24.patch | 16.95 KB | thenchev |
Comments
Comment #1
woprrr commentedOkay I go look this. @see https://www.drupal.org/node/2418529
Comment #2
slashrsm commentedComment #3
slashrsm commentedComment #4
bojanz commentedThere's no patch here.
Comment #5
woprrr commentedIts true ! yersterday i propose a patch promise ;)
Comment #6
slashrsm commentedComment #7
thenchev commentedHere is first patch.
Comment #8
bojanz commented- You are adding an extra newline.
- Variables must be snake_case, not camelCase. So $target_type, not $targetType
- You can't name a variable $settings2 :) Maybe go with $instance_settings and $widget_settings.
Comment #9
thenchev commentedOh actually that was some debugging code :/ missed that this morning will make a fix quick
Comment #10
thenchev commentedShould look better now.
Comment #11
bojanz commentedThanks! This looks almost ready to go.
We need to confirm this behaves properly for the "all bundles allowed" use case.
The selection handler that receives these settings has the following comment:
The test would be to create an entity reference field with no bundles selected, test IEF with this patch to confirm the autocomplete still works.
Comment #12
slashrsm commentedLooks good to me. Thank you!
Comment #13
slashrsm commented:)
Comment #14
thenchev commentedCreated a separate content type for test, if that's overkill i can maybe work on adding the field to the already available content types.
Comment #16
thenchev commentedComment #22
thenchev commentedSo didn't go over other tests before. Now targets the right button and changed my added field to not be required or i would had to made more changes and additions.
Comment #23
slashrsm commentedThis for loop assumes NIDs increment by 1. Since this is usually the case we can't assume it will always be so.
This test will fail in environment where database will be configured to use different PK increment step.
Comment #24
thenchev commentedAddressed #23.
Comment #25
slashrsm commentedCommitted. Thank you.