working on satisfaction form and introducing two new custom fields
This commit is contained in:
parent
4dc9efb19f
commit
ff2dab5599
|
|
@ -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');
|
||||
66
includes/forms/field-ClassicRating.php
Normal file
66
includes/forms/field-ClassicRating.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
if (class_exists('GF_Field')) {
|
||||
class ClassicRating extends GF_Field_Radio
|
||||
{
|
||||
public $type = 'classic-rating';
|
||||
|
||||
public $choices = [
|
||||
[
|
||||
'text' => '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());
|
||||
}
|
||||
67
includes/forms/field-HomegradeRating.php
Normal file
67
includes/forms/field-HomegradeRating.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
if (class_exists('GF_Field')) {
|
||||
class HomegradeRating extends GF_Field_Radio
|
||||
{
|
||||
public $type = 'homegrade-rating';
|
||||
|
||||
public $choices = [
|
||||
[
|
||||
'text' => '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());
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user