The Dragtable widget seems to break when used on a required, empty Entity Reference field while creating/editing a node.
If there are values already in the field (if the field was never set to Required), everything works fine. Once the field is emptied (even without saving the node), you can no longer add items.
This seems to be related to the NotNull constraint on the field that's applied when it is set to Required. We either need to limit the validation errors or resolve the AJAX issue of the NotNull constraint trigger when adding items.
On new nodes, there is no error message, it just doesn't work. If you check the errors in the form_state, there is an empty error added to the form_state errors, which causing it not to work. Filtering out empty error messages in a form_alter works, but I believe this is related to the NotNull/Required issue.
On existing nodes already containing referenced entities on the field, if you remove all of those references and then try to add another (all without saving the node), you get the following error message: "This value should not be null."
Tested this by creating a fresh Drupal 8.7.1 install with EntityQueue 8.x-1.x-dev, but issue also appears on Drupal 8.6.15 and EntityQueue 8.x-1.x-dev and 8.x-1.0-beta2.
It's possible this is an issue related to EntityReferenceFieldItemList or something in Core, but I was unable to find any issues relating to it.
| Comment | File | Size | Author |
|---|---|---|---|
| new-node-error.PNG | 4.37 KB | PaulDinelle | |
| existing-node-error.PNG | 6.17 KB | PaulDinelle |
Issue fork entityqueue-3054631
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
amateescu commentedMerged a fix for this.