I needed to apply this configuration in the form item:
'tags' => array(
'#type' => 'autocomplete_deluxe',
'#title' => t('Add a minimum of 5 labels in your image'),
'#prefix' => '<div class="image-tags-field">',
'#suffix' => '</div>',
'#size' => 60,
'#limit' => 10,
'#min_length' => 0,
'#use_synonyms' => 0,
'#delimiter' => '',
'#not_found_message' => "The term '@term' will be added.",
'#element_validate' => array('sto_collection_tags_validate'),
'#multiple' => TRUE,
'#autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/field_tags', array('absolute' => TRUE)),
'#default_value' => $tags,
'#disabled' => !$incomplete,
),
Where $incomplete refers to a status node, but basically I wanted to set to TRUE in some cases. The input field is disabled but no the rest of items and controls.
So I've made some changes and the #disabled option is used by the autocomplete widget to disable the remove tags event and search event.
I apologize I don't know how to create I patch form the current version so I'll leave the following lines of code:
In autocomplete_deluxe.module in line 278 I've made this change:
$js_settings['autocomplete_deluxe'][$html_id] = array(
'input_id' => $html_id,
'multiple' => $element['#multiple'],
'required' => $element['#required'],
'limit' => isset($element['#limit']) ? $element['#limit'] : 10,
'min_length' => isset($element['#min_length']) ? $element['#min_length'] : 0,
'use_synonyms' => isset($element['#use_synonyms']) ? $element['#use_synonyms'] : 0,
'delimiter' => isset($element['#delimiter']) ? $element['#delimiter'] : '',
'not_found_message' => isset($element['#not_found_message']) ? $element['#not_found_message'] : "The term '@term' will be added.",
'disabled' => isset($element['#disabled'])? $element['#disabled'] : false,
);
In autocomplete_deluxe.js in line 310 I've made this change:
if (!self.widget.disabled) self.remove(item);
And in autocomplete_deluxe.js in line 379 I've wrapped the binding setup in the following conditional:
//Binding events
if (!this.disabled) {
parent.mouseup(function() {
jqObject.autocomplete('search', '');
....
....
jqObject.keyup(function (event) {
if (clear) {
// Trigger the search, so it display the values for an empty string.
jqObject.autocomplete('search', '');
jqObject.val('');
clear = false;
// Return false to prevent entering the last character.
return false;
}
});
}
I hope this can help someone or somehow to improve this excellent module!
Thanks!
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.