The current Drupal core autocompletion has some limitations that we would like to get rid of for Linkit 7.x-2.x.
These limitations consists mainly of:
- The "slash bug" which cannot be resolved until Drupal core fixes it (it seems like it won't happen). This affects Linkit hard since external URI:s will generate an error which can't be controlled by Linkit
- We would potentially like a grouping feature, which groups nodes, users etc. together in the autocomplete results. This is not possible atm.
- Restriction of only sending one key-value param for a result in auto-complete. At the moment, the key consists of the plain text that should be inserted into the form field ("
Title [path:node/123]" for Linkit), value consists of the HTML that should be inserted into the result row. We may want to send other params as well, and we could, as a bonus, also generate most of the HTML client side instead. E.g. we could send a JSON-object instead consisting of many keys-value pairs, like
"type, systemPath, alias, title, description, imageSrc"etc. No limitations, that is!
- Event-driven architecture. Drupal autocompletion is poorly extensible/designed so there are no (good) ways for module developers to communicate with the autocomplete field. There are no client side event callbacks available for interaction with the user nor the server so no messages from autocomplete to Linkit. There are also no ways to control autocompletion, for example to make it start completion after at least three characters are typed. So no messages from Linkit to autocomplete either! We could design this much better.
All this appearantly sucks bad, and I'm not touching those ugly "Hey, I found a nice hack" thingys in the first place, so my suggestion, obviously, is to build an entirely new, shiny, bug-free and extensible autocomplete feature for Linkit. Nothing prevents us to use the existing code and some guy already understood this and wrote some things which we could hopefully use as well.