class-evf-field-address.php
7 years ago
class-evf-field-checkbox.php
6 years ago
class-evf-field-country.php
7 years ago
class-evf-field-credit-card.php
7 years ago
class-evf-field-date-time.php
6 years ago
class-evf-field-email.php
6 years ago
class-evf-field-file-upload.php
6 years ago
class-evf-field-first-name.php
6 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
6 years ago
class-evf-field-likert.php
7 years ago
class-evf-field-number.php
6 years ago
class-evf-field-password.php
7 years ago
class-evf-field-payment-checkbox.php
7 years ago
class-evf-field-payment-quantity.php
6 years ago
class-evf-field-payment-radio.php
7 years ago
class-evf-field-payment-single.php
7 years ago
class-evf-field-payment-total.php
6 years ago
class-evf-field-phone.php
7 years ago
class-evf-field-radio.php
6 years ago
class-evf-field-rating.php
7 years ago
class-evf-field-scale-rating.php
7 years ago
class-evf-field-select.php
6 years ago
class-evf-field-signature.php
7 years ago
class-evf-field-text.php
6 years ago
class-evf-field-textarea.php
6 years ago
class-evf-field-title.php
6 years ago
class-evf-field-url.php
6 years ago
class-evf-field-first-name.php
89 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', |
| 33 | ), |
| 34 | ), |
| 35 | 'advanced-options' => array( |
| 36 | 'field_options' => array( |
| 37 | 'placeholder', |
| 38 | 'label_hide', |
| 39 | 'css', |
| 40 | ), |
| 41 | ), |
| 42 | ); |
| 43 | |
| 44 | parent::__construct(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Field preview inside the builder. |
| 49 | * |
| 50 | * @since 1.0.0 |
| 51 | * @param array $field Field settings. |
| 52 | */ |
| 53 | public function field_preview( $field ) { |
| 54 | |
| 55 | // Define data. |
| 56 | $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : ''; |
| 57 | |
| 58 | // Label. |
| 59 | $this->field_preview_option( 'label', $field ); |
| 60 | |
| 61 | // Primary input. |
| 62 | echo '<input type="text" placeholder="' . esc_attr( $placeholder ) . '" class="widefat" disabled>'; |
| 63 | |
| 64 | // Description. |
| 65 | $this->field_preview_option( 'description', $field ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Field display on the form front-end. |
| 70 | * |
| 71 | * @since 1.0.0 |
| 72 | * |
| 73 | * @param array $field Field Data. |
| 74 | * @param array $deprecated Deprecated Parameter. |
| 75 | * @param array $form_data Form Data. |
| 76 | */ |
| 77 | public function field_display( $field, $deprecated, $form_data ) { |
| 78 | // Define data. |
| 79 | $primary = $field['properties']['inputs']['primary']; |
| 80 | |
| 81 | // Primary field. |
| 82 | printf( |
| 83 | '<input type="text" %s %s>', |
| 84 | evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ), |
| 85 | esc_attr( $primary['required'] ) |
| 86 | ); |
| 87 | } |
| 88 | } |
| 89 |