PluginProbe
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.6.1
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.6.1
3.6.1 3.6.0 3.5.3 3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 165 releases
everest-forms / includes / fields / class-evf-field-url.php
class-evf-field-url.php
94 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * URL field.
4 *
5 * @package EverestForms\Fields
6 * @since 1.0.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * EVF_Field_URL class.
13 */
14 class EVF_Field_URL extends EVF_Form_Fields {
15
16 /**
17 * Constructor.
18 */
19 public function __construct() {
20 $this->name = esc_html__( 'Website / URL', 'everest-forms' );
21 $this->type = 'url';
22 $this->icon = 'evf-icon evf-icon-website';
23 $this->order = 10;
24 $this->group = 'advanced';
25 $this->settings = array(
26 'basic-options' => array(
27 'field_options' => array(
28 'label',
29 'description',
30 'required',
31 'required_field_message_setting',
32 'required_field_message',
33 ),
34 ),
35 'advanced-options' => array(
36 'field_options' => array(
37 'placeholder',
38 'meta',
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 // Define data.
61 $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
62
63 // Label.
64 $this->field_preview_option( 'label', $field );
65
66 // Primary input.
67 echo '<input type="url" placeholder="' . esc_attr( $placeholder ) . '" class="widefat" disabled>';
68
69 // Description.
70 $this->field_preview_option( 'description', $field );
71 }
72
73 /**
74 * Field display on the form front-end.
75 *
76 * @since 1.0.0
77 *
78 * @param array $field Field Data.
79 * @param array $field_atts Field attributes.
80 * @param array $form_data All Form Data.
81 */
82 public function field_display( $field, $field_atts, $form_data ) {
83 // Define data.
84 $primary = $field['properties']['inputs']['primary'];
85
86 // Primary field.
87 printf(
88 '<input type="url" %s %s >',
89 evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
90 esc_attr( $primary['required'] )
91 );
92 }
93 }
94