PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | front-end/default-fields/select2/select2.js +17 -3 3.9.9 → 4.0.3 View file →
@@ -6,11 +6,25 @@
6 6 */
7 7 function wppb_select2_initialize() {
8 8 jQuery ( '.custom_field_select2' ).each( function(){
9 9 var selectElement = jQuery( this );
10 - var arguments = selectElement.attr('data-wppb-select2-arguments');
11 - arguments = JSON.parse( arguments );
12 - selectElement.select2( arguments ).on('select2:open', function(){
10 + var select2Arguments = selectElement.attr( 'data-wppb-select2-arguments' );
11 +
12 + if ( select2Arguments ) {
13 + select2Arguments = JSON.parse( select2Arguments );
14 + } else {
15 + select2Arguments = {};
16 + }
17 +
18 + select2Arguments = wp.hooks.applyFilters( 'wppb_select2_initialize_arguments', select2Arguments, selectElement );
19 +
20 + // On a multiple select the placeholder lands in the inline search box, which is only as
21 + // wide as the free space left by the selected options, so the field title gets truncated.
22 + if ( !selectElement.prop( 'multiple' ) && ( !( 'placeholder' in select2Arguments ) || select2Arguments.placeholder === '' ) ) {
23 + select2Arguments.placeholder = jQuery('label[for="' + selectElement.attr('id') + '"]').text();
24 + }
25 +
26 + selectElement.select2( select2Arguments ).on('select2:open', function(){
13 27 // compatibility with Divi Overlay
14 28 if( jQuery(selectElement).parents( '.overlay-container' ).length ){
15 29 jQuery(selectElement).data('select2').dropdown.$dropdownContainer.css( 'z-index', '99999999' );
16 30 }