Drupal 7.39 added a new required attribute to the $element: #autocomplete_input. This attribute is added by a new function in core includes/form.inc, form_process_autocomplete().

There are two possible places to add a function_exists() check and a call to form_process_autocomplete(). One alternative is in function entity_autocomplete_element_info(), where #process can refer to both entity_autocomplete_element_process() and form_process_autocomplete(). This works, but is cosmetically unattractive, with a ternary operator inside a return array.

The other alternative is to add the code at the end of entity_autocomplete_element_process(). This works as well, and is clearer to understand.

Other contributed modules have addressed this issue in similar fashion. See https://www.drupal.org/node/2554553 (entityreference_autocomplete) and https://www.drupal.org/node/2558605 (autocomplete_widgets), for example.

CommentFileSizeAuthor
#2 autocomplete_in_7.39-2597319-1.patch600 bytesRobert_T

Comments

Robert_T created an issue. See original summary.

Robert_T’s picture

StatusFileSize
new600 bytes

Patch file for review and testing.

b-prod’s picture

Status: Active » Needs review

Thanks for your patch, I will review it soon.

  • 4d45dd2 committed on 7.x-1.x
    Issue #2597319 by Robert_T: Entity autocomplete broken in Drupal 7.39
    
b-prod’s picture

Status: Needs review » Fixed

New release created to handle this compatibility issue with new versions of Drupal.

Status: Fixed » Closed (fixed)

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