Skip to content

Instantly share code, notes, and snippets.

@jrfoell
Last active July 15, 2019 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrfoell/9705ef6975c1c94672df719dc25adb94 to your computer and use it in GitHub Desktop.
Save jrfoell/9705ef6975c1c94672df719dc25adb94 to your computer and use it in GitHub Desktop.
newSelect2 from ACF 5.6.5
/**
* acf.newSelect2
*
* description
*
* @date 13/1/18
* @since 5.6.5
*
* @param type $var Description. Default.
* @return type Description.
*/
acf.newSelect2 = function( $select, props ){
// defaults
props = acf.parseArgs(props, {
allowNull: false,
placeholder: '',
multiple: false,
field: false,
ajax: false,
ajaxAction: '',
ajaxData: function( data ){ return data; },
ajaxResults: function( json ){ return json; },
});
// initialize
if( getVersion() == 4 ) {
var select2 = new Select2_4( $select, props );
} else {
var select2 = new Select2_3( $select, props );
}
// actions
acf.doAction('new_select2', select2);
// return
return select2;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment