PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.1.0
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.1.0
1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
← All changes | inc/fields/input-markup.php +25 -3 0.0.11.1.0 View file →
@@ -28,8 +28,24 @@
28 28 */
29 29 protected $max_length = 100;
30 30
31 31 /**
32 + * Input mask pattern for the input field.
33 + *
34 + * @var string
35 + * @since 1.0.0
36 + */
37 + protected $input_mask = '';
38 +
39 + /**
40 + * Custom input mask pattern for the input field.
41 + *
42 + * @var string
43 + * @since 1.0.0
44 + */
45 + protected $custom_input_mask = '';
46 +
47 + /**
32 48 * Initialize the properties based on block attributes.
33 49 *
34 50 * @param array<string, mixed> $attributes Block attributes.
35 51 * @since 0.0.1
@@ -34,10 +50,12 @@
34 50 * @param array<string, mixed> $attributes Block attributes.
35 51 * @since 0.0.1
36 52 */
37 53 public function __construct( $attributes ) {
38 - $this->slug = 'input';
39 - $this->max_length = isset( $attributes['maxLength'] ) ? absint( Helper::get_string_value( $attributes['maxLength'] ) ) : 100;
54 + $this->slug = 'input';
55 + $this->max_length = isset( $attributes['maxLength'] ) ? absint( Helper::get_string_value( $attributes['maxLength'] ) ) : 100;
56 + $this->input_mask = isset( $attributes['inputMask'] ) ? Helper::get_string_value( $attributes['inputMask'] ) : 'none';
57 + $this->custom_input_mask = 'custom-mask' === $this->input_mask && isset( $attributes['customInputMask'] ) ? Helper::get_string_value( $attributes['customInputMask'] ) : '';
40 58
41 59 $this->set_properties( $attributes );
42 60 $this->set_unique_slug();
43 61 $this->set_markup_properties();
@@ -76,11 +94,15 @@
76 94 <?php } ?>
77 95 <?php if ( '' !== $this->placeholder ) { ?>
78 96 placeholder="<?php echo esc_attr( $this->placeholder ); ?>"
79 97 <?php } ?>
98 + data-sd-mask="<?php echo esc_attr( $this->input_mask ); ?>"
99 + <?php if ( ! empty( $this->custom_input_mask ) ) { ?>
100 + data-custom-sd-mask="<?php echo esc_attr( $this->custom_input_mask ); ?>"
101 + <?php } ?>
80 102 />
81 103 </div>
82 - <?php echo wp_kses_post( $this->error_msg_markup ); ?>
104 + <div class="sd-error-wrap"><?php echo wp_kses_post( $this->error_msg_markup ); ?></div>
83 105 </div>
84 106 <?php
85 107 return (string) ob_get_clean();
86 108 }