68 lines
1.4 KiB
PHP
68 lines
1.4 KiB
PHP
<?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());
|
|
}
|