bump and updated changelog

This commit is contained in:
Mte90 2019-03-27 21:50:14 +01:00
parent f6cbf3b434
commit 716920f25a
3 changed files with 16 additions and 10 deletions

View File

@ -27,7 +27,7 @@ if( ! class_exists( 'CMB2_Field_Ajax_Search' ) ) {
/**
* Current version number
*/
const VERSION = '1.0.2';
const VERSION = '1.0.3';
/**
* Initialize the plugin by hooking into CMB2
@ -116,8 +116,8 @@ if( ! class_exists( 'CMB2_Field_Ajax_Search' ) ) {
echo $field_type->input( array(
'type' => 'text',
'name' => $field->_name() . '_input',
'id' => $field_name . '_input',
'name' => '_' . $field->_name(),
'id' => $field_name,
'class' => 'cmb-ajax-search cmb-' . $object_to_search . '-ajax-search',
'value' => $input_value,
'desc' => false,

View File

@ -3,7 +3,7 @@
$('.cmb-ajax-search:not([data-ajax-search="true"])').each(function () {
$(this).attr('data-ajax-search', true);
var field_id = $(this).attr('id').replace( new RegExp('_input$'), '' ).replace(/[\[\]']+/g, '_'); // Field id, the true one field
var field_id = $(this).attr('id').replace(/[\[\]']+/g, '_'); // Field id, the true one field
var object_type = $(this).attr('data-object-type');
var query_args = $(this).attr('data-query-args');
@ -50,17 +50,17 @@
onSelect: function ( suggestion ) {
$(this).devbridgeAutocomplete('clearCache');
var field_name = $(this).attr('name').replace( new RegExp('_input$'), '' );
var field_name = $(this).attr('name');
var multiple = $(this).attr('data-multiple');
var limit = parseInt( $(this).attr('data-limit') );
var sortable = $(this).attr('data-sortable');
var field_name_temp = field_name.replace( /[\[\]']+/g, '_' );
var field_name_temp = field_name.substring(1).replace( /[\[\]']+/g, '_' );
if( multiple == 1 ) {
// Multiple
$('#' + field_name_temp + '_results' ).append( '<li>' +
( ( sortable == 1 ) ? '<span class="hndl"></span>' : '' ) +
'<input type="hidden" name="' + field_name + '[]" value="' + suggestion.id + '">' +
'<input type="hidden" name="' + field_name.substring(1) + '[]" value="' + suggestion.id + '">' +
'<a href="' + suggestion.link + '" target="_blank" class="edit-link">' + suggestion.value + '</a>' +
'<a class="remover"><span class="dashicons dashicons-no"></span><span class="dashicons dashicons-dismiss"></span></a>' +
'</li>' );

View File

@ -62,7 +62,7 @@ function cmb2_ajax_search_metabox() {
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'posts',
'type' => 'post_ajax_search',
'multiple' => true,
'multiple-item' => true,
'limit' => 10,
'query_args' => array(
'post_type' => array( 'post', 'page' ),
@ -88,7 +88,7 @@ function cmb2_ajax_search_metabox() {
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'users',
'type' => 'user_ajax_search',
'multiple' => true,
'multiple-item' => true,
'limit' => 5,
'query_args' => array(
'role__not_in' => array( 'Administrator', 'Editor' ),
@ -113,7 +113,7 @@ function cmb2_ajax_search_metabox() {
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'terms',
'type' => 'term_ajax_search',
'multiple' => true,
'multiple-item' => true,
'limit' => -1,
'query_args' => array(
'taxonomy' => 'post_tag',
@ -156,6 +156,12 @@ If multiple == true will return an array of IDs of attached object:
## Changelog
### 1.0.3
* Fixed issues with repeatable fields
* Removed unused code
* Moved to new paramenter `multiple-item` to avoid conflicts with CMB2
### 1.0.2
* Updated devbridgeAutocomplete lib