From ff2dab5599fb4bd5c4dd8a460c8c507148e31048 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 23 May 2024 16:21:01 +0200 Subject: [PATCH] working on satisfaction form and introducing two new custom fields --- includes/forms.php | 4 ++ includes/forms/field-ClassicRating.php | 66 +++++++++++++++++++++++ includes/forms/field-HomegradeRating.php | 67 ++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 includes/forms/field-ClassicRating.php create mode 100644 includes/forms/field-HomegradeRating.php diff --git a/includes/forms.php b/includes/forms.php index 78a234b..4b79886 100644 --- a/includes/forms.php +++ b/includes/forms.php @@ -4,3 +4,7 @@ require_once(__DIR__ . '/forms/field-OrderBrochureList.php'); require_once(__DIR__ . '/forms/field-OrderDocumentsList.php'); +require_once(__DIR__ . '/forms/field-HomegradeRating.php'); +require_once(__DIR__ . '/forms/field-ClassicRating.php'); + +add_filter('gform_confirmation_anchor_gform_21', '__return_false'); \ No newline at end of file diff --git a/includes/forms/field-ClassicRating.php b/includes/forms/field-ClassicRating.php new file mode 100644 index 0000000..5a44df1 --- /dev/null +++ b/includes/forms/field-ClassicRating.php @@ -0,0 +1,66 @@ + 'Non', + 'value' => 1, + 'isSelected' => false, + ], + [ + 'text' => 'Un peu', + 'value' => 2, + 'isSelected' => false, + 'price' => '' + ], + [ + 'text' => 'Moyen', + 'value' => 3, + 'isSelected' => false, + ], + [ + 'text' => 'Beaucoup', + 'value' => 4, + 'isSelected' => false, + ], + [ + 'text' => 'Parfait', + 'value' => 5, + 'isSelected' => false, + ], + ]; + + + public function get_form_editor_field_title() + { + return esc_attr__('Notation classique', 'homegrade-theme__texte-fonctionnel'); + } + public function get_form_editor_button() + { + return [ + 'group' => 'advanced_fields', + 'text' => $this->get_form_editor_field_title(), + ]; + } + public function get_form_editor_field_icon() + { + return 'dashicons-star-filled'; + } + public function get_form_editor_field_settings() + { + return [ + 'label_setting', + 'choices_setting', + 'description_setting', + 'rules_setting', + 'error_message_setting', + 'css_class_setting', + 'conditional_logic_field_setting' + ]; + } + } + GF_Fields::register(new ClassicRating()); +} diff --git a/includes/forms/field-HomegradeRating.php b/includes/forms/field-HomegradeRating.php new file mode 100644 index 0000000..d8a348b --- /dev/null +++ b/includes/forms/field-HomegradeRating.php @@ -0,0 +1,67 @@ + 'Non', + 'value' => 1, + 'isSelected' => false, + ], + [ + 'text' => 'Un peu', + 'value' => 2, + 'isSelected' => false, + 'price' => '' + ], + [ + 'text' => 'Moyen', + 'value' => 3, + 'isSelected' => false, + ], + [ + 'text' => 'Beaucoup', + 'value' => 4, + 'isSelected' => false, + ], + + [ + 'text' => 'Parfait', + 'value' => 5, + 'isSelected' => false, + ], + ]; + + + public function get_form_editor_field_title() + { + return esc_attr__('Notation Satisfaction Homegrade', 'homegrade-theme__texte-fonctionnel'); + } + public function get_form_editor_button() + { + return [ + 'group' => 'advanced_fields', + 'text' => $this->get_form_editor_field_title(), + ]; + } + public function get_form_editor_field_icon() + { + return 'dashicons-star-filled'; + } + public function get_form_editor_field_settings() + { + return [ + 'label_setting', + 'choices_setting', + 'description_setting', + 'rules_setting', + 'error_message_setting', + 'css_class_setting', + 'conditional_logic_field_setting' + ]; + } + } + GF_Fields::register(new HomegradeRating()); +}