PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / trunk
JetFormBuilder — Dynamic Blocks Form Builder vtrunk
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / blocks-v2 / phone-field / block-template.php
jetformbuilder / modules / blocks-v2 / phone-field Last commit date
admin-tabs 2 months ago assets 3 weeks ago tools 2 months ago block-asset.php 1 month ago block-render.php 2 months ago block-template.php 2 months ago block-type.php 2 months ago block.json 2 months ago postcss.config.js 2 months ago webpack.config.js 2 months ago
block-template.php
111 lines
1 <?php
2 /**
3 * Phone Field Template
4 *
5 * @var Block_Render $this
6 * @var array $args
7 */
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 // Set the field value (from preset, default, or submitted data)
15 $this->set_value();
16
17 // Add standard input attributes
18 $this->add_attribute( 'type', 'tel' );
19 $this->add_attribute( 'placeholder', $args['placeholder'] );
20 $this->add_attribute( 'required', $this->block_type->get_required_val() );
21 $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) );
22 $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) );
23 $this->add_attribute( 'data-field-name', $args['name'] );
24 $this->add_attribute( 'class', 'jet-form-builder__field phone-field' );
25 $this->add_attribute( 'class', $args['class_name'] );
26 $this->add_attribute( 'data-jfb-sync' );
27 $this->add_attribute( 'autocomplete', 'tel' );
28 $this->add_attribute( 'data-default-country', esc_attr( $args['default_country'] ?? 'auto' ) );
29
30 if ( ! empty( $args['preferred_countries'] ) ) {
31 $preferred_countries = $args['preferred_countries'];
32
33 $this->add_attribute(
34 'data-preferred-countries',
35 esc_attr( $preferred_countries )
36 );
37 }
38
39 if ( ! empty( $args['only_countries'] ) && $args['only_countries'] ) {
40 $countries = $args['only_countries'];
41
42 $this->add_attribute(
43 'data-only-countries',
44 esc_attr( $countries )
45 );
46 }
47
48 if ( ! empty( $args['exclude_countries'] ) ) {
49 $exclude_countries = $args['exclude_countries'];
50
51 $this->add_attribute(
52 'data-exclude-countries',
53 esc_attr( $exclude_countries )
54 );
55 }
56
57 if ( ! empty( $args['save_format'] ) ) {
58 $this->add_attribute( 'data-save-format', esc_attr( $args['save_format'] ) );
59 }
60
61 // Handle ipinfo.io token (global or per-block)
62 $ipinfo_token = '';
63
64 if ( ! empty( $args['use_global'] ) && $args['use_global'] ) {
65 // Use global token from settings
66 $global_options = \Jet_Form_Builder\Admin\Tabs_Handlers\Tab_Handler_Manager::get_options( 'phone-field-tab' );
67 $ipinfo_token = $global_options['ipinfo_token'] ?? '';
68 } elseif ( ! empty( $args['ipinfo_token'] ) ) {
69 // Use per-block token
70 $ipinfo_token = $args['ipinfo_token'];
71 }
72
73 if ( ! empty( $ipinfo_token ) ) {
74 $this->add_attribute( 'data-ipinfo-token', esc_attr( $ipinfo_token ) );
75 }
76
77 if ( ! empty( $args['validation_message_required'] ) ) {
78 $this->add_attribute( 'data-validation-message-required', esc_attr( $args['validation_message_required'] ) );
79 }
80
81 if ( ! empty( $args['validation_message_invalid'] ) ) {
82 $this->add_attribute( 'data-validation-message-invalid', esc_attr( $args['validation_message_invalid'] ) );
83 }
84
85 $separate_dial_code = '';
86
87 if ( ! empty( $args['separate_dial_code'] ) ) {
88 $separate_dial_code = $args['separate_dial_code'] ? 'separate-dial-code' : '';
89 $this->add_attribute( 'data-separate-dial-code', esc_attr( $args['separate_dial_code'] ) );
90 }
91
92 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
93 ?>
94 <div class="jet-form-builder__field-wrap phone-field-wrap <?php echo $separate_dial_code; ?>">
95 <?php do_action( 'jet-form-builder/before-field', $this ); ?>
96
97 <input <?php $this->render_attributes_string(); ?>>
98
99 <input
100 type="tel"
101 name="<?php echo $this->block_type->get_field_name( $args['name'] . '_intl' ); ?>"
102 data-field-name="<?php echo $args['name'] . '_intl'; ?>"
103 class="jet-form-builder__field phone-field-intl <?php echo $args['class_name']; ?> "
104 value=""
105 autocomplete="tel"
106 >
107
108 <?php do_action( 'jet-form-builder/after-field', $this ); ?>
109 </div>
110 <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
111