Added autocomplete options hook
This commit is contained in:
parent
973308f0be
commit
b00b91ec85
|
@ -188,7 +188,8 @@ if( ! class_exists( 'CMB2_Field_Ajax_Search' ) ) {
|
||||||
|
|
||||||
wp_localize_script( 'cmb-ajax-search', 'cmb_ajax_search', array(
|
wp_localize_script( 'cmb-ajax-search', 'cmb_ajax_search', array(
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||||
'nonce' => wp_create_nonce( 'cmb_ajax_search_get_results' )
|
'nonce' => wp_create_nonce( 'cmb_ajax_search_get_results' ),
|
||||||
|
'options' => apply_filters( 'cmb_field_ajax_search_autocomplete_options', array() )
|
||||||
) );
|
) );
|
||||||
|
|
||||||
wp_enqueue_script( 'cmb-ajax-search' );
|
wp_enqueue_script( 'cmb-ajax-search' );
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
var object_type = $(this).attr('data-object-type');
|
var object_type = $(this).attr('data-object-type');
|
||||||
var query_args = $(this).attr('data-query-args');
|
var query_args = $(this).attr('data-query-args');
|
||||||
|
|
||||||
$(this).devbridgeAutocomplete({
|
$(this).devbridgeAutocomplete(Object.assign({
|
||||||
serviceUrl: cmb_ajax_search.ajaxurl,
|
serviceUrl: cmb_ajax_search.ajaxurl,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
triggerSelectOnValidInput: false,
|
triggerSelectOnValidInput: false,
|
||||||
|
@ -78,7 +78,8 @@
|
||||||
$('input[name=' + field_name + ']').val( suggestion.id ).change();
|
$('input[name=' + field_name + ']').val( suggestion.id ).change();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
cmb_ajax_search.options));
|
||||||
|
|
||||||
if( $(this).attr('data-sortable') == 1 ){
|
if( $(this).attr('data-sortable') == 1 ){
|
||||||
$('#' + field_id + '_results').sortable({
|
$('#' + field_id + '_results').sortable({
|
||||||
|
|
Loading…
Reference in New Issue