Last active
July 15, 2019 19:52
-
-
Save jrfoell/9705ef6975c1c94672df719dc25adb94 to your computer and use it in GitHub Desktop.
newSelect2 from ACF 5.6.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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