class-evf-field-address.php
1 year ago
class-evf-field-ai.php
1 year ago
class-evf-field-captcha.php
4 weeks ago
class-evf-field-checkbox.php
2 months ago
class-evf-field-color.php
4 weeks ago
class-evf-field-country.php
2 months ago
class-evf-field-credit-card.php
4 weeks ago
class-evf-field-date-time.php
4 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
4 weeks ago
class-evf-field-number.php
1 year ago
class-evf-field-password.php
4 weeks ago
class-evf-field-payment-authorize-net.php
4 weeks ago
class-evf-field-payment-checkbox.php
4 weeks ago
class-evf-field-payment-coupon.php
4 weeks ago
class-evf-field-payment-gateway-selector.php
4 weeks ago
class-evf-field-payment-quantity.php
4 weeks ago
class-evf-field-payment-radio.php
4 weeks ago
class-evf-field-payment-single.php
4 weeks ago
class-evf-field-payment-square.php
1 year ago
class-evf-field-payment-subscription-plan.php
4 weeks ago
class-evf-field-payment-subtotal.php
4 weeks ago
class-evf-field-payment-total.php
4 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
4 weeks ago
class-evf-field-radio.php
2 months ago
class-evf-field-range-slider.php
4 weeks ago
class-evf-field-rating.php
2 months ago
class-evf-field-recaptcha.php
4 months ago
class-evf-field-repeater.php
4 weeks ago
class-evf-field-reset.php
4 weeks ago
class-evf-field-scale-rating.php
1 year ago
class-evf-field-select.php
1 year ago
class-evf-field-signature.php
4 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
4 weeks ago
class-evf-field-divider.php
123 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Divider field. |
| 4 | * |
| 5 | * @package EverestForms_Pro\Fields |
| 6 | * @since 3.0.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Field_Divider Class. |
| 13 | */ |
| 14 | class EVF_Field_Divider extends EVF_Form_Fields { |
| 15 | |
| 16 | /** |
| 17 | * Constructor. |
| 18 | */ |
| 19 | public function __construct() { |
| 20 | $this->name = __( 'Divider', 'everest-forms' ); |
| 21 | $this->type = 'divider'; |
| 22 | $this->icon = 'evf-icon evf-icon-divider'; |
| 23 | $this->order = 85; |
| 24 | $this->group = 'advanced'; |
| 25 | $this->settings = array( |
| 26 | 'basic-options' => array( |
| 27 | 'field_options' => array( |
| 28 | 'divider_type', |
| 29 | ), |
| 30 | ), |
| 31 | 'advanced-options' => array( |
| 32 | 'field_options' => array( |
| 33 | 'css', |
| 34 | ), |
| 35 | ), |
| 36 | ); |
| 37 | |
| 38 | parent::__construct(); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Type field option. |
| 43 | * |
| 44 | * @param array $field Field data. |
| 45 | */ |
| 46 | public function divider_type( $field ) { |
| 47 | $lbl = $this->field_element( |
| 48 | 'label', |
| 49 | $field, |
| 50 | array( |
| 51 | 'slug' => 'divider_type', |
| 52 | 'value' => esc_html__( 'Divider Type', 'everest-forms' ), |
| 53 | 'tooltip' => sprintf( esc_html__( 'Select the type of seperator displayed on frontend.', 'everest-forms' ) ), |
| 54 | ), |
| 55 | false |
| 56 | ); |
| 57 | $fld = $this->field_element( |
| 58 | 'select', |
| 59 | $field, |
| 60 | array( |
| 61 | 'slug' => 'divider_type', |
| 62 | 'value' => ! empty( $field['divider_type'] ) ? $field['divider_type'] : '', |
| 63 | 'options' => array( |
| 64 | 'default' => esc_html__( 'Plain', 'everest-forms' ), |
| 65 | 'dashed' => esc_html__( 'Dashed', 'everest-forms' ), |
| 66 | 'dotted' => esc_html__( 'Dotted', 'everest-forms' ), |
| 67 | 'thick' => esc_html__( 'Thick', 'everest-forms' ), |
| 68 | 'double' => esc_html__( 'Double', 'everest-forms' ), |
| 69 | ), |
| 70 | ), |
| 71 | false |
| 72 | ); |
| 73 | $args = array( |
| 74 | 'slug' => 'divider_type', |
| 75 | 'content' => $lbl . $fld, |
| 76 | ); |
| 77 | $this->field_element( 'row', $field, $args ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Field preview inside the builder. |
| 82 | * |
| 83 | * @since 1.7.5 |
| 84 | * |
| 85 | * @param array $field Field data and settings. |
| 86 | */ |
| 87 | public function field_preview( $field ) { |
| 88 | $divider_type = ! empty( $field['divider_type'] ) ? esc_attr( $field['divider_type'] ) : ''; |
| 89 | printf( '<hr class = "evf-divider %s"/>', esc_attr( $divider_type ) ); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Field display on the form front-end. |
| 94 | * |
| 95 | * @since 1.7.5 |
| 96 | * |
| 97 | * @param array $field Field Data. |
| 98 | * @param array $field_atts Field attributes. |
| 99 | * @param array $form_data All Form Data. |
| 100 | */ |
| 101 | public function field_display( $field, $field_atts, $form_data ) { |
| 102 | // Setup and sanitize the necessary data. |
| 103 | $primary = $field['properties']['inputs']['primary']; |
| 104 | $field = apply_filters( 'everest_forms_select_field_display', $field, $field_atts, $form_data ); |
| 105 | $divider_type = ! empty( $field['divider_type'] ) ? esc_attr( $field['divider_type'] ) : ''; |
| 106 | $primary['class'] = array_merge( $primary['class'], array( 'evf-divider ', $divider_type ) ); |
| 107 | printf( |
| 108 | '<hr %s/>', |
| 109 | evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ) |
| 110 | ); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Formats and sanitizes field. |
| 115 | * |
| 116 | * @param int $field_id Field id. |
| 117 | * @param array $field_submit Field submit value. |
| 118 | * @param array $form_data Form data object. |
| 119 | * @param string $meta_key Meta key data for the field. |
| 120 | */ |
| 121 | public function format( $field_id, $field_submit, $form_data, $meta_key ) {} |
| 122 | } |
| 123 |