The "Inline entity form - Simple" widget isn't compatible with bundle-less entities.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | interdiff.txt | 1.42 KB | dawehner |
| #28 | 2569193-28.patch | 11.85 KB | dawehner |
| #23 | interdiff.txt | 8.02 KB | dawehner |
| #23 | 2569193-23.patch | 11.65 KB | dawehner |
| #22 | 2569193-22.patch | 2.55 KB | dawehner |
Comments
Comment #2
skyredwangThis file has been renamed to InlineEntityFormComplex.php
This change seems to be only coding style change.
After the patching, the form still reports "You must enter a username.", even though the username has been entered.
Comment #3
eyal shalevComment #4
zviryatko commentedUpdated patch accordingly to
Comment #5
tedbowSetting to needs review to run test. Pretty sure this will need to re-rolled though because of changes to module
Comment #6
tedbowApplied the patch but it doesn't fix it for me.
Same for me
Comment #7
tedbowOk here is TEST_ONLY patch for now. This fails of course now.
Will need to be re-written when we get this functionality working.
Comment #9
tedbowargggh forgot undo function renames for local testing.
Will still fail.
Comment #11
bojanz commentedI'm not sure user is the best entity type to use in a test, the AccountForm is almost completely custom, which means that as soon as we start using the form mode, this test will fail. Better use nodes.
Comment #12
tedbowHow can we test for entities without bundles if we are using nodes?
Comment #13
bojanz commentedOh, right. Fun. Back to the drawing board.
Comment #14
yce commentedLooks like the first hunk is no longer needed, I've recreated the patch for the latest dev version.
Comment #15
jan.mashat commentedComment #17
yce commentedComment #19
boobaaManual tests say the patch solves the issue of the "Remove" button(s), so it looks like the automated tests need to be fixed.
Comment #20
bojanz commentedThe tests are correct.
The previous code was loading the form display for the parent entity.
The new code loads the form display for the inline entity.
Hence the settings don't get loaded and the entity doesn't get removed from the system.
Comment #21
bojanz commentedCommitted a more correct fix:
https://github.com/bojanz/inline_entity_form/commit/274143d6748b8aaa02eb...
What remains now is to make the Simple widget support bundle-less entities, by removing the condition from InlineEntityFormSimple::isApplicable(), and to commit Ted's test.
Comment #22
dawehnerI'm using this hack for now, this missing tests though for example.
Comment #23
dawehnerFor a second I though, sure let's just apply the test from tedbow, together with my fix, done.
As it turns out after quite some debugging, using the user as test entity doesn't really make sense anymore, because we switched away from using the entity from, but rather have our own inline form.
This patch adds now test coverage using its own special entity type without bundle support.
Comment #24
dawehnerI tried to make a critical self review ... wasn't that easy :)
This would be nice to have a quick comment.
Comment #25
benjy commentedThis patch worked well for me. Thanks dawehner.
Comment #27
bojanz commented1) Don't we usually prefer "target" over "reference"? So $target_entity_type_id?
2) Let's assign \Drupal::entityTypeManager()->getDefinition($reference_entity_type_id) to a $target_entity_type, cleaner
3) Let's add a comment above return TRUE ("The target entity type doesn't use bundles, no need to validate them."?)
4) Wouldn't actually $target_entity_type->getKey('bundle') be more generic than checking for getBundleEntityType()?
5) The comment at the end is no longer relevant, we can delete it. In fact, we can reduce the entire bottom of the method to checking if count target bundles is 1, no?
Comment #28
dawehnerGreat review!
I fear that that target_bundles might not be set. Just having the count would result in a notice, see https://3v4l.org/lt6dR
Comment #29
bojanz commentedLooks good, ship it!
Comment #31
dawehnerThank you @bojanz!