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.)

Comments

David_Rothstein’s picture

Status: Active » Needs review
StatusFileSize
new687 bytes

Here's a patch.

plach’s picture

I'd be tempted to say that if someone stores anything different from an entity type string into a form #entity_type key, 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.

plach’s picture

Status: Needs review » Reviewed & tested by the community

I'd say this is good to go, thanks.

bforchhammer’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed and pushed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

minor fix

  • Commit 62a5090 on 7.x-1.x, et-permissions-1829630, factory, et-fc, revisions authored by plach, committed by bforchhammer:
    Issue #1846104 by David_Rothstein, plach: Fixed Entity Translation...

  • Commit 62a5090 on 7.x-1.x, et-permissions-1829630, factory, et-fc, revisions, workbench authored by plach, committed by bforchhammer:
    Issue #1846104 by David_Rothstein, plach: Fixed Entity Translation...