| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 5 |
|
| 6 |
function wppb_toolbox_datepicker_starts_on_monday( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){ |
| 7 |
$field_id = $field['meta-name']; |
| 8 |
|
| 9 |
$script = '<script> |
| 10 |
jQuery(function(){ |
| 11 |
jQuery("#'. $field_id . '").each( function(){ |
| 12 |
var currentDatepicker = this; |
| 13 |
jQuery( currentDatepicker ).datepicker("destroy"); |
| 14 |
jQuery( currentDatepicker ).datepicker({ |
| 15 |
inline: true, |
| 16 |
changeYear: true, |
| 17 |
changeMonth: true, |
| 18 |
dateFormat: jQuery( currentDatepicker ).data("dateformat"), |
| 19 |
firstDay: 1, |
| 20 |
yearRange: "c-100:c+30" |
| 21 |
}); |
| 22 |
}); |
| 23 |
}); |
| 24 |
</script>'; |
| 25 |
|
| 26 |
return $output . $script; |
| 27 |
} |
| 28 |
add_filter( 'wppb_output_form_field_datepicker', 'wppb_toolbox_datepicker_starts_on_monday', 20, 6 ); |
| 29 |
add_filter( 'wppb_admin_output_form_field_datepicker', 'wppb_toolbox_datepicker_starts_on_monday', 20, 6 ); |
| 30 |
|