The attached patch enhances the autocomplete list in serveral ways:
- It improves the code quality of the
autocomplete.jsand moves all JS objects to the
- The cursor is now moved to the end of the textfield in Safari when a user selects an autocomplete item.
- It allows modules to provide more than just one string for an autocomplete entry, allowing “rich” items. For example, you can use bold formatting, links and even images (e.g. avatars when autocompleting users). This allows modules to give more context when selecting an item. E.g. when a node should be selected, it’s often hard to tell from the title of the node if it’s the correct one. Additional information are often useful.
Also, there is a new theme function
theme_autocomplete_itemthat allows themes to modify the structure of an autocomplete item.
- There is a new field
infoin the autocomplete JSON object which can contain general information about the autocompletion. In the patch it is for example used to display the user who many items in addition to the 10 displayed were found. This is a freeform HTML field that is not selectable (as opposed to regular items).