67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
if (class_exists('GF_Field')) {
|
|
class HomegradeRating extends GF_Field_Radio
|
|
{
|
|
public $type = 'homegrade-rating';
|
|
|
|
public $choices = [
|
|
[
|
|
'text' => 'Pas du tout utile',
|
|
'value' => 1,
|
|
'isSelected' => false,
|
|
],
|
|
[
|
|
'text' => 'Peu utile',
|
|
'value' => 2,
|
|
'isSelected' => false,
|
|
'price' => ''
|
|
],
|
|
[
|
|
'text' => 'Moyennement utile',
|
|
'value' => 3,
|
|
'isSelected' => false,
|
|
],
|
|
[
|
|
'text' => 'Assez utile',
|
|
'value' => 4,
|
|
'isSelected' => false,
|
|
],
|
|
|
|
[
|
|
'text' => 'Très utile',
|
|
'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());
|
|
}
|