class-evf-field-address.php
1 week ago
class-evf-field-ai.php
1 year ago
class-evf-field-captcha.php
1 month ago
class-evf-field-checkbox.php
3 months ago
class-evf-field-color.php
1 month ago
class-evf-field-country.php
3 months ago
class-evf-field-credit-card.php
1 month ago
class-evf-field-date-time.php
1 month 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
5 months ago
class-evf-field-hidden.php
1 year ago
class-evf-field-html.php
10 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
1 month ago
class-evf-field-number.php
1 year ago
class-evf-field-password.php
1 month ago
class-evf-field-payment-authorize-net.php
1 month ago
class-evf-field-payment-checkbox.php
1 month ago
class-evf-field-payment-coupon.php
1 month ago
class-evf-field-payment-gateway-selector.php
1 month ago
class-evf-field-payment-quantity.php
1 month ago
class-evf-field-payment-radio.php
1 month ago
class-evf-field-payment-single.php
1 month ago
class-evf-field-payment-square.php
2 years ago
class-evf-field-payment-subscription-plan.php
1 month ago
class-evf-field-payment-subtotal.php
1 month ago
class-evf-field-payment-total.php
1 month ago
class-evf-field-phone.php
1 year ago
class-evf-field-privacy-policy.php
3 months ago
class-evf-field-private-note.php
1 year ago
class-evf-field-progress.php
1 month ago
class-evf-field-radio.php
3 months ago
class-evf-field-range-slider.php
1 month ago
class-evf-field-rating.php
3 months ago
class-evf-field-recaptcha.php
5 months ago
class-evf-field-repeater.php
1 month ago
class-evf-field-reset.php
1 month ago
class-evf-field-scale-rating.php
1 year ago
class-evf-field-select.php
1 year ago
class-evf-field-signature.php
1 month 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
5 months ago
class-evf-field-url.php
1 year ago
class-evf-field-wysiwyg.php
3 months ago
class-evf-field-yes-no.php
1 year ago
payment-amount-helpers.php
1 month ago
class-evf-field-signature.php
108 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Signature field. |
| 4 | * |
| 5 | * @package EverestForms\Fields |
| 6 | * @since 1.4.7 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Field_Signature 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 | * upload, exporters) lives in Everest Forms Pro, whose class loads in place of |
| 18 | * this one when the plugin is active (this file is only autoloaded when that |
| 19 | * class is not already defined). Keep `is_pro = true` so the field stays locked. |
| 20 | */ |
| 21 | class EVF_Field_Signature extends EVF_Form_Fields { |
| 22 | |
| 23 | /** |
| 24 | * Default value options. |
| 25 | * |
| 26 | * @var array |
| 27 | */ |
| 28 | public $defaults_option_value; |
| 29 | |
| 30 | /** |
| 31 | * Constructor. |
| 32 | */ |
| 33 | public function __construct() { |
| 34 | $this->name = esc_html__( 'Signature', 'everest-forms' ); |
| 35 | $this->type = 'signature'; |
| 36 | $this->icon = 'evf-icon evf-icon-signature'; |
| 37 | $this->order = 100; |
| 38 | $this->group = 'advanced'; |
| 39 | $this->is_pro = true; |
| 40 | $this->links = array( |
| 41 | 'image_id' => '', |
| 42 | 'vedio_id' => 'oF-9ooqfUpk', |
| 43 | ); |
| 44 | $this->settings = array( |
| 45 | 'basic-options' => array( |
| 46 | 'field_options' => array( |
| 47 | 'label', |
| 48 | 'description', |
| 49 | 'required', |
| 50 | 'required_field_message_setting', |
| 51 | 'required_field_message', |
| 52 | 'option_display', |
| 53 | ), |
| 54 | ), |
| 55 | 'advanced-options' => array( |
| 56 | 'field_options' => array( |
| 57 | 'meta', |
| 58 | 'label_hide', |
| 59 | 'css', |
| 60 | ), |
| 61 | ), |
| 62 | ); |
| 63 | |
| 64 | $this->defaults_option_value = array( |
| 65 | 'background_color' => 'rgb(255, 255, 255)', |
| 66 | 'pen_color' => 'rgba(0,0,0,1)', |
| 67 | 'image_format' => 'png', |
| 68 | ); |
| 69 | |
| 70 | parent::__construct(); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Field preview inside the builder. |
| 75 | * |
| 76 | * @param array $field Field data and settings. |
| 77 | */ |
| 78 | public function field_preview( $field ) { |
| 79 | // Label. |
| 80 | $this->field_preview_option( 'label', $field ); |
| 81 | |
| 82 | echo "<canvas style='width:100%;height:100px;max-width:100%;max-height:100%;'></canvas>"; |
| 83 | |
| 84 | // Description. |
| 85 | $this->field_preview_option( 'description', $field ); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Option display in sidebar. |
| 90 | * |
| 91 | * @param array $field Field Data. |
| 92 | */ |
| 93 | public function option_display( $field ) { |
| 94 | $file_format = $this->defaults_option_value['image_format']; |
| 95 | $field_options = sprintf( '<input type="hidden" name="form_fields[%s][signature_file_format]" value="%s" />', esc_attr( $field['id'] ), esc_attr( $file_format ) ); |
| 96 | |
| 97 | // Field option row (markup) including label and input. |
| 98 | $this->field_element( |
| 99 | 'row', |
| 100 | $field, |
| 101 | array( |
| 102 | 'slug' => 'signature', |
| 103 | 'content' => $field_options, |
| 104 | ) |
| 105 | ); |
| 106 | } |
| 107 | } |
| 108 |