wip resolving date format pbm, already figured out where it comes from and how to create a new one
This commit is contained in:
12
plugins/fbpatch/js/dates.js
Normal file
12
plugins/fbpatch/js/dates.js
Normal file
@@ -0,0 +1,12 @@
|
||||
let datepicker_wrapper = document.querySelector(".datepicker-wrapper");
|
||||
console.log("datepicker-wrapper: ", datepicker_wrapper);
|
||||
|
||||
let mydate = document.createElement("input");
|
||||
mydate.setAttribute('type', 'text');
|
||||
mydate.setAttribute('style', 'margin-top:10px;');
|
||||
datepicker_wrapper.appendChild(mydate);
|
||||
|
||||
console.log("mydate: ", mydate);
|
||||
mydate.value = "oups";
|
||||
|
||||
$(mydate).datepicker({dateFormat: "yymmdd",});
|
||||
@@ -44,10 +44,11 @@ class Fbpatch {
|
||||
|
||||
private static $_patches = [
|
||||
'_name'=>'fbpatch_list_of_patches',
|
||||
'calculations'=>['checked'=>true, 'title'=>'calculations', 'description'=>"afficher le total des calculs dès l'ouverture des formulaires"],
|
||||
'hide_show' =>['checked'=>true, 'title'=>'masquer les offres', 'description'=>"permettre de masquer les offres en editant un formulaire, sans les supprimer"],
|
||||
'modals' =>['checked'=>false, 'title'=>'modals', 'description'=>"permettre plusieurs modals sur une meme page"],
|
||||
'urls' =>['checked'=>false, 'title'=>'urls', 'description'=>"permettre de rentrer des urls sans 'http://'"],
|
||||
'dates' => ['checked'=>true, 'title'=>'dates', 'description'=>"gerer des dates dans n'importe quels formats"],
|
||||
'calculations'=> ['checked'=>true, 'title'=>'calculations', 'description'=>"afficher le total des calculs dès l'ouverture des formulaires"],
|
||||
'hide_show' => ['checked'=>true, 'title'=>'masquer les offres', 'description'=>"permettre de masquer les offres en editant un formulaire, sans les supprimer"],
|
||||
'modals' => ['checked'=>false, 'title'=>'modals', 'description'=>"permettre plusieurs modals sur une meme page"],
|
||||
'urls' => ['checked'=>false, 'title'=>'urls', 'description'=>"permettre de rentrer des urls sans 'http://'"],
|
||||
];
|
||||
|
||||
private static function set_option_patches() {
|
||||
|
||||
101
plugins/fbpatch/php/patches/dates.php
Normal file
101
plugins/fbpatch/php/patches/dates.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
- when jquery choose the date format,
|
||||
it also creates a hidden field with the value formated as 'yymmdd' (Ymd)
|
||||
- before dfb saves the post queries,
|
||||
saves the acf-date of the hidden field into a special property of the acf field
|
||||
and removes it from the post-array
|
||||
|
||||
- jquery creates a hidden field with the value formated as 'yymmdd' (Ymd)
|
||||
- before insert post in dfb :
|
||||
- find the hidden field, and for which acf field it is
|
||||
- save this data in the acf field
|
||||
- also save the formated date in the acf field, in a class maybe ?
|
||||
- add a filter for the acf field, when it displays the field, to show the formated value
|
||||
|
||||
../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/scripts/builder-bundle.min.js
|
||||
|
||||
jquery date picker :
|
||||
7509 : ../../../../wordpress_docker/volumes/wp-volumes/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
function add_form_builder_dates_patch() {
|
||||
$handle = 'form_builder_dates_patch';
|
||||
$url = Fbpatch::root_url() . '/js/dates.js';
|
||||
$dependencies = array();
|
||||
$version = null;
|
||||
$defer = true;
|
||||
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_dates_patch', 22);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function add_form_builder_calculations_patch() {
|
||||
$handle = 'form_builder_calculations_patch';
|
||||
$url = Fbpatch::root_url() . '/js/calculations.js';
|
||||
$dependencies = array('de_fb_calc');
|
||||
$version = null;
|
||||
$defer = true;
|
||||
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_calculations_patch', 22);
|
||||
*/
|
||||
|
||||
/*
|
||||
* actions after partner form is validated
|
||||
*
|
||||
* -> the date is output in edit form - 7505 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php
|
||||
* -> 845 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*/
|
||||
function partner_after_form_CIPF($form_id, $post_array, $form_type) {
|
||||
// error_log("form_id: " . json_encode($form_id));
|
||||
// error_log("post_array: " . json_encode($post_array));
|
||||
// error_log("form_type: " . json_encode($form_type));
|
||||
}
|
||||
//add_action('df_after_process', 'partner_after_form_CIPF', 10, 3);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* -> 506 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*/
|
||||
function partner_before_insert_post_CIPF($form_id, $post_array) {
|
||||
// error_log("form_id: " . json_encode($form_id));
|
||||
// error_log("post_array: " . json_encode($post_array));
|
||||
// error_log("form_type: " . json_encode($form_type));
|
||||
}
|
||||
//add_action('df_before_insert_post', 'partner_before_insert_post_CIPF', 10, 2);
|
||||
|
||||
|
||||
/*
|
||||
* -> 558 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
* post_array: {"post_status":"publish","meta_input":{"text":"testimon","_text":"field_662131b2b0e68","date_test":"20240427","_date_test":"field_66212132b126b"},"field_title":["text","date"],"ID":"43978","form_type_confirm":"","post_type":"post","tax_input":[],"post_date":"2024-04-18 15:32:43"}
|
||||
*
|
||||
*/
|
||||
function partner_after_insert_post_CIPF($form_id, $post_id, $post_array) {
|
||||
// error_log("form_id : " . json_encode($form_id));
|
||||
// error_log("post_id : " . json_encode($post_id));
|
||||
// error_log("post_array: " . json_encode($post_array));
|
||||
}
|
||||
//add_action('df_after_insert_post', 'partner_after_insert_post_CIPF', 10, 3);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user