I've got #1659586: Support Taxonomy term reference fields working apart from error messages from taxonomy_field_is_empty().
Turns out it's because this hook gets some data it probably shouldn't be.
Here's debug output from an entityreference field:

| Comment | File | Size | Author |
|---|---|---|---|
| ief-junk-data-hook_field_is_empty-1.png | 83.84 KB | joachim |
Comments
Comment #1
joachim commentedNote that I have *no idea* how 'taxonomy_sport' gets in there. That's probably weirdness at my end.
Comment #2
bojanz commentedTricky.
The is_empty hook is not actually a hook, it is a callback:
which means we can't override it, and we can't ever give it correct data (since we fill the field only during hook_field_attach_submit).
That code is invoked from two places: field_default_validate() and field_default_submit(), and those two functions always run.
Perhaps we can just make sure that they get NULL or something?
Maybe by having an #element_validate function like inline_entity_form_save_row_weights(), that just does form_set_value($element, NULL, $form_state); ?
(Btw, what's the exact error message? I looked at taxonomy_field_is_empty, didn't see which part would throw the error, since there's an empty() check there...)
Comment #3
joachim commentedIt complains that there's no 'tid' set in its array.
(BTW, it's hacky, but one think I've done in custom modules for projects is sneakily change $field['module'] in my field widget alter, to then make it come back to me for the callbacks.)
Comment #4
bojanz commentedvasike now has a patch in #1659586: Support Taxonomy term reference fields.