PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 1.3.1
JetFormBuilder — Dynamic Blocks Form Builder v1.3.1
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 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 All 130 releases
jetformbuilder / templates / fields / text-field.php
text-field.php
66 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * input[type="hidden"] template
4 *
5 * @var Base $this
6 * @var array $args
7 */
8
9 use Jet_Form_Builder\Blocks\Render\Base;
10
11 $this->add_attribute( 'placeholder', $args['placeholder'] );
12 $this->add_attribute( 'value', $args['default'] );
13 $this->add_attribute( 'required', $this->block_type->get_required_val() );
14 $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) );
15 $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) );
16 $this->add_attribute( 'type', $args['field_type'] );
17 $this->add_attribute( 'data-field-name', $args['name'] );
18 $this->add_attribute( 'class', 'jet-form-builder__field text-field' );
19 $this->add_attribute( 'class', $args['class_name'] );
20 $this->add_attribute( 'class', $this->maybe_get_error_class( $args ) );
21 $this->add_attribute( 'minlength', $args['minlength'] );
22 $this->add_attribute( 'maxlength', $args['maxlength'] );
23
24
25 if ( ! empty( $args['enable_input_mask'] ) && ! empty( $args['input_mask'] ) ) {
26 $this->add_attribute( 'class', 'jet-form-builder__masked-field' );
27
28 $mask_type = ! empty( $args['mask_type'] ) ? $args['mask_type'] : '';
29
30 if ( $mask_type ) {
31 $this->add_attribute( 'data-inputmask', '\'alias\': \'' . esc_attr( $mask_type ) . '\'' );
32 $this->add_attribute( 'data-inputmask-inputformat', esc_attr( $args['input_mask'] ) );
33 $this->add_attribute( 'data-inputmask-inputmode', 'verbatim' );
34 } else {
35 $this->add_attribute( 'data-inputmask', '\'mask\': \'' . esc_attr( $args['input_mask'] ) . '\'' );
36 }
37
38 $mask_placeholder = ! empty( $args['mask_placeholder'] ) ? esc_attr( $args['mask_placeholder'] ) : '';
39
40 if ( $mask_placeholder ) {
41 $this->add_attribute( 'data-inputmask-placeholder', $mask_placeholder );
42 }
43
44 $mask_visibility = ! empty( $args['mask_visibility'] ) ? $args['mask_visibility'] : 'always';
45
46 switch ( $mask_visibility ) {
47 case 'focus':
48 $this->add_attribute( 'data-inputmask-showmaskonhover', 'false' );
49 break;
50
51 case 'hover':
52 $this->add_attribute( 'data-inputmask-showmaskonhover', 'true' );
53 $this->add_attribute( 'data-inputmask-showmaskonfocus', 'true' );
54 break;
55
56 default:
57 $this->add_attribute( 'data-inputmask-clearmaskonlostfocus', 'false' );
58 break;
59 }
60
61 }
62 ?>
63 <div class="jet-form-builder__field-wrap">
64 <input <?php $this->render_attributes_string(); ?>>
65 <?php echo $this->maybe_render_error( $args ); ?>
66 </div>