Entity Translation has code in entity_translation_entity_form_get_handler() which runs on all forms and takes action whenever $form['#entity_type'] is set.
However, it only works if $form['#entity_type'] is a string; otherwise errors can result.
Given that this runs on all forms, it should be more careful about checking that it's working with what it expects. (For a particular case where this causes problems, the patch at #1604598: Improved support for bundle options, configuration, and managing per-bundle fields (for the Entity Construction Kit module) happens to set this form key to an object. I'm going to be posting a new patch there soon which winds up avoiding that for other reasons anyway, but it's still an issue in theory.)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | entity-translation-entity-type-string-1846104-2.patch | 676 bytes | plach |
| #1 | entity-translation-entity-type-string-1846104-1.patch | 687 bytes | David_Rothstein |
Comments
Comment #1
David_Rothstein commentedHere's a patch.
Comment #2
plachI'd be tempted to say that if someone stores anything different from an entity type string into a form
#entity_typekey, then he's looking for trouble. However it seems we actually need this additional check.Anyway, the attached patch looks slightly more readable to me.
Comment #3
plachI'd say this is good to go, thanks.
Comment #4
bforchhammer commentedThanks, committed and pushed.
Comment #5.0
(not verified) commentedminor fix