class-evf-field-address.php
7 years ago
class-evf-field-ai.php
2 years ago
class-evf-field-captcha.php
2 years ago
class-evf-field-checkbox.php
3 years ago
class-evf-field-color.php
3 years ago
class-evf-field-country.php
7 years ago
class-evf-field-credit-card.php
2 years ago
class-evf-field-date-time.php
2 years ago
class-evf-field-divider.php
4 years ago
class-evf-field-email.php
2 years ago
class-evf-field-file-upload.php
6 years ago
class-evf-field-first-name.php
2 years ago
class-evf-field-hidden.php
7 years ago
class-evf-field-html.php
7 years ago
class-evf-field-image-upload.php
7 years ago
class-evf-field-last-name.php
2 years ago
class-evf-field-likert.php
2 years ago
class-evf-field-lookup.php
2 years ago
class-evf-field-number.php
2 years ago
class-evf-field-password.php
7 years ago
class-evf-field-payment-authorize-net.php
2 years ago
class-evf-field-payment-checkbox.php
7 years ago
class-evf-field-payment-coupon.php
2 years ago
class-evf-field-payment-quantity.php
5 years ago
class-evf-field-payment-radio.php
7 years ago
class-evf-field-payment-single.php
7 years ago
class-evf-field-payment-subtotal.php
3 years ago
class-evf-field-payment-total.php
6 years ago
class-evf-field-phone.php
7 years ago
class-evf-field-privacy-policy.php
4 years ago
class-evf-field-progress.php
3 years ago
class-evf-field-radio.php
3 years ago
class-evf-field-range-slider.php
6 years ago
class-evf-field-rating.php
7 years ago
class-evf-field-repeater.php
2 years ago
class-evf-field-reset.php
3 years ago
class-evf-field-scale-rating.php
2 years ago
class-evf-field-select.php
3 years ago
class-evf-field-signature.php
7 years ago
class-evf-field-text.php
2 years ago
class-evf-field-textarea.php
3 years ago
class-evf-field-title.php
6 years ago
class-evf-field-url.php
2 years ago
class-evf-field-wysiwyg.php
4 years ago
class-evf-field-yes-no.php
2 years ago
class-evf-field-first-name.php
94 lines
| 1 | <?php |
| 2 | /** |
| 3 | * First name field. |
| 4 | * |
| 5 | * @package EverestForms\Fields |
| 6 | * @since 1.0.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Field_First_Name class. |
| 13 | */ |
| 14 | class EVF_Field_First_Name extends EVF_Form_Fields { |
| 15 | |
| 16 | /** |
| 17 | * Constructor. |
| 18 | */ |
| 19 | public function __construct() { |
| 20 | $this->name = esc_html__( 'First Name', 'everest-forms' ); |
| 21 | $this->type = 'first-name'; |
| 22 | $this->icon = 'evf-icon evf-icon-first-name'; |
| 23 | $this->order = 10; |
| 24 | $this->group = 'general'; |
| 25 | $this->settings = array( |
| 26 | 'basic-options' => array( |
| 27 | 'field_options' => array( |
| 28 | 'label', |
| 29 | 'meta', |
| 30 | 'description', |
| 31 | 'required', |
| 32 | 'required_field_message_setting', |
| 33 | 'required_field_message', |
| 34 | ), |
| 35 | ), |
| 36 | 'advanced-options' => array( |
| 37 | 'field_options' => array( |
| 38 | 'placeholder', |
| 39 | 'label_hide', |
| 40 | 'default_value', |
| 41 | 'css', |
| 42 | 'regex_validation', |
| 43 | 'regex_value', |
| 44 | 'regex_message', |
| 45 | ), |
| 46 | ), |
| 47 | ); |
| 48 | |
| 49 | parent::__construct(); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Field preview inside the builder. |
| 54 | * |
| 55 | * @since 1.0.0 |
| 56 | * |
| 57 | * @param array $field Field data and settings. |
| 58 | */ |
| 59 | public function field_preview( $field ) { |
| 60 | |
| 61 | // Define data. |
| 62 | $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : ''; |
| 63 | |
| 64 | // Label. |
| 65 | $this->field_preview_option( 'label', $field ); |
| 66 | |
| 67 | // Primary input. |
| 68 | echo '<input type="text" placeholder="' . esc_attr( $placeholder ) . '" class="widefat" disabled>'; |
| 69 | |
| 70 | // Description. |
| 71 | $this->field_preview_option( 'description', $field ); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Field display on the form front-end. |
| 76 | * |
| 77 | * @since 1.0.0 |
| 78 | * |
| 79 | * @param array $field Field Data. |
| 80 | * @param array $field_atts Field attributes. |
| 81 | * @param array $form_data All Form Data. |
| 82 | */ |
| 83 | public function field_display( $field, $field_atts, $form_data ) { |
| 84 | // Define data. |
| 85 | $primary = $field['properties']['inputs']['primary']; |
| 86 | // Primary field. |
| 87 | printf( |
| 88 | '<input type="text" %s %s>', |
| 89 | evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ), |
| 90 | esc_attr( $primary['required'] ) |
| 91 | ); |
| 92 | } |
| 93 | } |
| 94 |