Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I make some test with Apache Solr Autocomplete and Apache Solr 6.x-3.0-rc1 modules. The autocomplete doesn't work in each case so i make my own autocomplete module with php code of 7.x series and js of 6.x series and it work. Sources are in the attach file.
Comment | File | Size | Author |
---|---|---|---|
#5 | apachesolr_autocomplete.module.txt | 17.98 KB | kaythikhaing07 |
apachesolr_autocomplete.zip | 26.32 KB | n.dhuygelaere |
Comments
Comment #1
nicja CreditAttribution: nicja commentedThanks for this.
I had to change the function apachesolr_autocomplete_do_alter on line 74 in apachesolr_autocomplete.module to set $element['#attributes']['class'] to a string instead of an array, in order to get the custom widget to work.
If $element['#attributes']['class'] is set as an array the class 'Array' is applied to the element insted of 'apachesolr-autocomplete unprocessed'
This is for a site running drupal 6.26
Comment #2
soulfroysHello @dhuygelaere!
Thank you for your code, works great! I just noticed that is not working in blocks...
Do you have this problem too?
I'm using:
- Apache Solr Search 6.x-3.x-dev (2013-Sep-16)
- Solr 4.4
Comment #3
Funksmaname CreditAttribution: Funksmaname commentedThanks for this - working on search page - but as soulfroys said, not working on the search block... any advice??
Comment #4
Funksmaname CreditAttribution: Funksmaname commentedAlso, this module is causing a 'security update available' warning on the site...?
Comment #5
kaythikhaing07 CreditAttribution: kaythikhaing07 commentedThanks @n.dhuygelaere. I changed apachesolr_autocomplete_do_alter() on you source code and fixed for appearing on block and theme form.
function apachesolr_autocomplete_do_alter(&$element) {
if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
// Create elements if they do not exist.
if (!isset($element['#attributes'])) {
$element['#attributes'] = array();
}
/*update START*/
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'apachesolr-autocomplete unprocessed';
}
else {
$element['#attributes']['class'] .= ' apachesolr-autocomplete unprocessed';
}
/*update END*/
}
else {
$element['#autocomplete_path'] = 'apachesolr_autocomplete';
}
}