class-evf-field-address.php
1 year ago
class-evf-field-ai.php
1 year ago
class-evf-field-captcha.php
3 weeks ago
class-evf-field-checkbox.php
2 months ago
class-evf-field-color.php
3 weeks ago
class-evf-field-country.php
2 months ago
class-evf-field-credit-card.php
3 weeks ago
class-evf-field-date-time.php
3 weeks ago
class-evf-field-divider.php
2 years ago
class-evf-field-email.php
1 year ago
class-evf-field-file-upload.php
1 year ago
class-evf-field-first-name.php
1 year ago
class-evf-field-hcaptcha.php
4 months ago
class-evf-field-hidden.php
1 year ago
class-evf-field-html.php
9 months ago
class-evf-field-image-upload.php
1 year ago
class-evf-field-last-name.php
1 year ago
class-evf-field-likert.php
1 year ago
class-evf-field-lookup.php
3 weeks ago
class-evf-field-number.php
1 year ago
class-evf-field-password.php
3 weeks ago
class-evf-field-payment-authorize-net.php
3 weeks ago
class-evf-field-payment-checkbox.php
3 weeks ago
class-evf-field-payment-coupon.php
3 weeks ago
class-evf-field-payment-gateway-selector.php
3 weeks ago
class-evf-field-payment-quantity.php
3 weeks ago
class-evf-field-payment-radio.php
3 weeks ago
class-evf-field-payment-single.php
3 weeks ago
class-evf-field-payment-square.php
1 year ago
class-evf-field-payment-subscription-plan.php
3 weeks ago
class-evf-field-payment-subtotal.php
3 weeks ago
class-evf-field-payment-total.php
3 weeks ago
class-evf-field-phone.php
1 year ago
class-evf-field-privacy-policy.php
2 months ago
class-evf-field-private-note.php
1 year ago
class-evf-field-progress.php
3 weeks ago
class-evf-field-radio.php
2 months ago
class-evf-field-range-slider.php
3 weeks ago
class-evf-field-rating.php
2 months ago
class-evf-field-recaptcha.php
4 months ago
class-evf-field-repeater.php
3 weeks ago
class-evf-field-reset.php
3 weeks ago
class-evf-field-scale-rating.php
1 year ago
class-evf-field-select.php
1 year ago
class-evf-field-signature.php
3 weeks ago
class-evf-field-text.php
1 year ago
class-evf-field-textarea.php
1 year ago
class-evf-field-title.php
2 years ago
class-evf-field-turnstile.php
4 months ago
class-evf-field-url.php
1 year ago
class-evf-field-wysiwyg.php
2 months ago
class-evf-field-yes-no.php
1 year ago
payment-amount-helpers.php
3 weeks ago
class-evf-field-reset.php
167 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Reset field |
| 4 | * |
| 5 | * @package EverestForms\Fields |
| 6 | * @since 1.4.3 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Field_Reset Class. |
| 13 | * |
| 14 | * Builder-scope (read-only) version shipped in the free plugin so the field can |
| 15 | * be shown LOCKED — with its real preview and readable settings — for the AI |
| 16 | * upsell. The full functional implementation (front-end display, validation, |
| 17 | * processing) lives in Everest Forms Pro, whose class loads in place of this one |
| 18 | * when the plugin is active (this file is only autoloaded when that class is not |
| 19 | * already defined). Keep `is_pro = true` so the field stays locked. |
| 20 | */ |
| 21 | class EVF_Field_Reset extends EVF_Form_Fields { |
| 22 | |
| 23 | /** |
| 24 | * Constructor. |
| 25 | */ |
| 26 | public function __construct() { |
| 27 | $this->name = esc_html__( 'Reset', 'everest-forms' ); |
| 28 | $this->type = 'reset'; |
| 29 | $this->icon = 'evf-icon evf-icon-reset'; |
| 30 | $this->order = 15; |
| 31 | $this->group = 'advanced'; |
| 32 | $this->is_pro = true; |
| 33 | $this->links = array( |
| 34 | 'image_id' => '', |
| 35 | 'vedio_id' => 'M7GE7EwSgx8', |
| 36 | ); |
| 37 | $this->settings = array( |
| 38 | 'basic-options' => array( |
| 39 | 'field_options' => array( |
| 40 | 'button_text', |
| 41 | 'button_type', |
| 42 | 'description', |
| 43 | ), |
| 44 | ), |
| 45 | 'advanced-options' => array( |
| 46 | 'field_options' => array( |
| 47 | 'css', |
| 48 | ), |
| 49 | ), |
| 50 | ); |
| 51 | |
| 52 | parent::__construct(); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Apply Button Text. |
| 57 | * |
| 58 | * @param array $field Field data object. |
| 59 | */ |
| 60 | public function button_text( $field ) { |
| 61 | |
| 62 | // Input Mask. |
| 63 | $lbl = $this->field_element( |
| 64 | 'label', |
| 65 | $field, |
| 66 | array( |
| 67 | 'slug' => 'button_text', |
| 68 | 'value' => esc_html__( 'Button Text', 'everest-forms' ), |
| 69 | 'tooltip' => esc_html__( 'Add text to the reset button', 'everest-forms' ), |
| 70 | ), |
| 71 | false |
| 72 | ); |
| 73 | $fld = $this->field_element( |
| 74 | 'text', |
| 75 | $field, |
| 76 | array( |
| 77 | 'slug' => 'button_text', |
| 78 | 'value' => ! empty( $field['button_text'] ) ? esc_attr( $field['button_text'] ) : __( 'Reset', 'everest-forms' ), |
| 79 | ), |
| 80 | false |
| 81 | ); |
| 82 | $this->field_element( |
| 83 | 'row', |
| 84 | $field, |
| 85 | array( |
| 86 | 'slug' => 'button_text', |
| 87 | 'content' => $lbl . $fld, |
| 88 | ) |
| 89 | ); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /** |
| 94 | * Apply Button Text. |
| 95 | * |
| 96 | * @param array $field Field data object. |
| 97 | */ |
| 98 | public function button_type( $field ) { |
| 99 | |
| 100 | // Input Mask. |
| 101 | $lbl = $this->field_element( |
| 102 | 'label', |
| 103 | $field, |
| 104 | array( |
| 105 | 'slug' => 'button_type', |
| 106 | 'value' => esc_html__( 'Button Type', 'everest-forms' ), |
| 107 | 'tooltip' => esc_html__( '1. Reset - Removes all the field values except the default values. |
| 108 | 2. Clear - Removes all field values, including the default values. |
| 109 | ', 'everest-forms' ), |
| 110 | ), |
| 111 | false |
| 112 | ); |
| 113 | $fld = $this->field_element( |
| 114 | 'select', |
| 115 | $field, |
| 116 | array( |
| 117 | 'slug' => 'button_type', |
| 118 | 'value' => ! empty( $field['button_type'] ) ? esc_attr( $field['button_type'] ) : 'reset', |
| 119 | 'options' => |
| 120 | array( |
| 121 | 'reset' => esc_html__( 'Reset', 'everest-forms' ), |
| 122 | 'button' => esc_html__( 'Clear', 'everest-forms' ), |
| 123 | ), |
| 124 | ), |
| 125 | false |
| 126 | ); |
| 127 | $this->field_element( |
| 128 | 'row', |
| 129 | $field, |
| 130 | array( |
| 131 | 'slug' => 'button_text', |
| 132 | 'content' => $lbl . $fld, |
| 133 | ) |
| 134 | ); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Field preview inside the builder. |
| 139 | * |
| 140 | * @since 1.0.0 |
| 141 | * |
| 142 | * @param array $field Field data and settings. |
| 143 | */ |
| 144 | public function field_preview( $field ) { |
| 145 | |
| 146 | // Label. |
| 147 | $this->field_preview_option( 'label', $field ); |
| 148 | |
| 149 | // Define data. |
| 150 | $button_label = ! empty( $field['button_text'] ) ? esc_attr( $field['button_text'] ) : __( 'Reset', 'everest-forms' ); |
| 151 | |
| 152 | // Primary Input. |
| 153 | |
| 154 | echo '<div class="everest-forms-reset-button">'; |
| 155 | |
| 156 | printf( |
| 157 | '<button type="button" class="evf-reset-button" disabled>%s</button>', |
| 158 | esc_html( $button_label ) |
| 159 | ); |
| 160 | |
| 161 | echo '</div>'; |
| 162 | |
| 163 | // Description. |
| 164 | $this->field_preview_option( 'description', $field ); |
| 165 | } |
| 166 | } |
| 167 |