@@ -470,9 +470,18 @@ function enqueue_scripts() {
470470 'enterEmail ' => __ ( 'Please enter the e-mail addresses in the forms above. ' , 'camptix ' ),
471471 'ajaxURL ' => admin_url ( 'admin-ajax.php ' ),
472472 ) );
473-
474473 // Let's play by the rules and print this in the <head> section.
475474 wp_enqueue_style ( 'camptix ' );
475+
476+
477+ if ( (bool ) $ this ->options ['select2_enabled ' ] ) {
478+ wp_register_style ( 'select2 ' , plugins_url ( '/external/select2/css/select2.min.css ' , __FILE__ ), array (), $ this ->version );
479+ wp_register_script ( 'select2 ' , plugins_url ( '/external/select2/js/select2.min.js ' , __FILE__ ), array (), $ this ->version );
480+
481+ wp_enqueue_style ( 'select2 ' );
482+ wp_enqueue_script ( 'select2 ' );
483+ }
484+
476485 }
477486
478487 function admin_enqueue_scripts () {
@@ -1493,8 +1502,11 @@ function menu_setup_controls() {
14931502 $ this ->add_settings_field_helper ( 'currency ' , __ ( 'Currency ' , 'camptix ' ), 'field_currency ' );
14941503
14951504 $ this ->add_settings_field_helper ( 'refunds_enabled ' , __ ( 'Enable Refunds ' , 'camptix ' ), 'field_enable_refunds ' , false ,
1496- __ ( "This will allows your customers to refund their tickets purchase by filling out a simple refund form. " , 'camptix ' )
1505+ __ ( "This will allow your customers to refund their tickets purchase by filling out a simple refund form. " , 'camptix ' )
14971506 );
1507+ $ this ->add_settings_field_helper ( 'select2_enabled ' , __ ( 'Enable Select2 ' , 'camptix ' ), 'field_enable_select2 ' , false ,
1508+ __ ( "This will render all the dropdown answers as a searchable dropdown instead of normal select dropdown " , 'camptix ' )
1509+ );
14981510
14991511 break ;
15001512 case 'payment ' :
@@ -1621,7 +1633,7 @@ function validate_options( $input ) {
16211633 if ( isset ( $ input ['refunds_date_end ' ], $ input ['refunds_enabled ' ] ) && (bool ) $ input ['refunds_enabled ' ] && strtotime ( $ input ['refunds_date_end ' ] ) )
16221634 $ output ['refunds_date_end ' ] = $ input ['refunds_date_end ' ];
16231635
1624- $ yesno_fields = array ( 'refunds_enabled ' );
1636+ $ yesno_fields = array ( 'refunds_enabled ' , ' select2_enabled ' );
16251637
16261638 // Beta features checkboxes
16271639 if ( $ this ->beta_features_enabled )
@@ -1766,6 +1778,17 @@ function field_enable_refunds( $args ) {
17661778 <?php
17671779 }
17681780
1781+ function field_enable_select2 ( $ args ) {?>
1782+ <div id="tix-select2-enabled-radios">
1783+ <label class="tix-yes-no description"><input type="radio" name="<?php echo esc_attr ( $ args ['name ' ] ); ?> " value="1" <?php checked ( $ args ['value ' ], true ); ?> > <?php _e ( 'Yes ' , 'camptix ' ); ?> </label>
1784+ <label class="tix-yes-no description"><input type="radio" name="<?php echo esc_attr ( $ args ['name ' ] ); ?> " value="0" <?php checked ( $ args ['value ' ], false ); ?> > <?php _e ( 'No ' , 'camptix ' ); ?> </label>
1785+ </div>
1786+ <?php if ( isset ( $ args ['description ' ] ) ) : ?>
1787+ <p class="description"><?php echo wp_kses_post ( $ args ['description ' ] ); ?> </p>
1788+ <?php endif ; ?>
1789+ <?php
1790+ }
1791+
17691792 /**
17701793 * The currency field for the Settings API.
17711794 */
@@ -5480,7 +5503,8 @@ function form_attendee_info() {
54805503 $ questions = $ this ->get_sorted_questions ( $ ticket ->ID );
54815504 ?>
54825505 <input type="hidden" name="tix_attendee_info[<?php echo esc_attr ( $ i ); ?> ][ticket_id]" value="<?php echo intval ( $ ticket ->ID ); ?> " />
5483- <table class="tix_tickets_table tix-attendee-form">
5506+ <table class="tix_tickets_table tix-attendee-form <?php echo ( isset ($ this ->options ['select2_enabled ' ]) && (bool ) ( $ this ->options ['select2_enabled ' ] ) ) ?
5507+ 'tix-select2-enabled ' : '' ?> ">
54845508 <tbody>
54855509 <tr>
54865510 <th colspan="2">
0 commit comments