PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 1.0.3
JetFormBuilder — Dynamic Blocks Form Builder v1.0.3
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 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 All 134 releases
jetformbuilder / templates / fields / text-field.php

text-field.php in JetFormBuilder — Dynamic Blocks Form Builder 1.0.3, at templates/fields/text-field.php

65 lines 2.2 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
6 $this->add_attribute( 'placeholder', $args['placeholder'] );
7 $this->add_attribute( 'value', $args['default'] );
8 $this->add_attribute( 'required', $this->block_type->get_required_val() );
9 $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) );
10 $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) );
11 $this->add_attribute( 'type', $args['field_type'] );
12 $this->add_attribute( 'data-field-name', $args['name'] );
13
14 if ( ! empty( $args['minlength'] ) ) {
15 $this->add_attribute( 'minlength', $args['minlength'] );
16 }
17
18 if ( ! empty( $args['maxlength'] ) ) {
19 $this->add_attribute( 'maxlength', $args['maxlength'] );
20 }
21
22 $mask_class = '';
23
24 if ( ! empty( $args['enable_input_mask'] ) && ! empty( $args['input_mask'] ) ) {
25 $mask_class = 'jet-form-builder__masked-field';
26
27 $mask_type = ! empty( $args['mask_type'] ) ? $args['mask_type'] : '';
28
29 if ( $mask_type ) {
30 $this->add_attribute( 'data-inputmask', '\'alias\': \'' . esc_attr( $mask_type ) . '\'' );
31 $this->add_attribute( 'data-inputmask-inputformat', esc_attr( $args['input_mask'] ) );
32 $this->add_attribute( 'data-inputmask-inputmode', 'verbatim' );
33 } else {
34 $this->add_attribute( 'data-inputmask', '\'mask\': \'' . esc_attr( $args['input_mask'] ) . '\'' );
35 }
36
37 $mask_placeholder = ! empty( $args['mask_placeholder'] ) ? esc_attr( $args['mask_placeholder'] ) : '';
38
39 if ( $mask_placeholder ) {
40 $this->add_attribute( 'data-inputmask-placeholder', $mask_placeholder );
41 }
42
43 $mask_visibility = ! empty( $args['mask_visibility'] ) ? $args['mask_visibility'] : 'always';
44
45 switch ( $mask_visibility ) {
46 case 'focus':
47 $this->add_attribute( 'data-inputmask-showmaskonhover', 'false' );
48 break;
49
50 case 'hover':
51 $this->add_attribute( 'data-inputmask-showmaskonhover', 'true' );
52 $this->add_attribute( 'data-inputmask-showmaskonfocus', 'true' );
53 break;
54
55 default:
56 $this->add_attribute( 'data-inputmask-clearmaskonlostfocus', 'false' );
57 break;
58 }
59
60 }
61
62 ?>
63 <div class="jet-form-builder__field-wrap">
64 <input class="jet-form-builder__field text-field <?php echo $mask_class; ?>"<?php $this->render_attributes_string(); ?>>
65 </div>