← All changes
|
includes/elementor/modules/checkout/fields/base.php
+12
-3
1.3.2
→
2.7.0
View file →
| @@ -112,9 +112,9 @@ | ||
| 112 | 112 | |
| 113 | 113 | ?> |
| 114 | 114 | <div class="sellkit-required-validation"> |
| 115 | 115 | <span class="required-alarm"> |
| 116 | - <?php echo __( 'This field is required.', 'sellkit' ); ?> | |
| 116 | + <?php echo esc_html__( 'This field is required.', 'sellkit' ); ?> | |
| 117 | 117 | </span> |
| 118 | 118 | </div> |
| 119 | 119 | <?php |
| 120 | 120 | } |
| @@ -212,8 +212,12 @@ | ||
| 212 | 212 | $defaults = [ 'sellkit-widget-checkout-fields', 'sellkit-checkout-fields-wrapper' ]; |
| 213 | 213 | $new_classes = []; |
| 214 | 214 | $is_width = true; |
| 215 | 215 | |
| 216 | + if ( ! is_array( $classes ) ) { | |
| 217 | + $classes = []; | |
| 218 | + } | |
| 219 | + | |
| 216 | 220 | foreach ( $defaults as $def ) { |
| 217 | 221 | if ( ! in_array( $def, $classes, true ) ) { |
| 218 | 222 | $new_classes[] = $def; |
| 219 | 223 | } |
| @@ -277,12 +281,13 @@ | ||
| 277 | 281 | * |
| 278 | 282 | * @param string $field html string. |
| 279 | 283 | * @param array $args checkout fields options. |
| 280 | 284 | * @param string $key key of field. |
| 285 | + * @param string $value value of field. | |
| 281 | 286 | * @return void |
| 282 | 287 | * @since 1.1.0 |
| 283 | 288 | */ |
| 284 | - public function final_html_structure( $field, $args, $key ) { | |
| 289 | + public function final_html_structure( $field, $args, $key, $value = null ) { | |
| 285 | 290 | $args = $this->additional_class( $args, $key ); |
| 286 | 291 | $args = $this->set_required_class( $args ); |
| 287 | 292 | $args = $this->make_sure_sellkit_native_classes_exists( $args ); |
| 288 | 293 | $args = $this->try_to_set_default_value( $args, $key ); |
| @@ -287,8 +292,12 @@ | ||
| 287 | 292 | $args = $this->make_sure_sellkit_native_classes_exists( $args ); |
| 288 | 293 | $args = $this->try_to_set_default_value( $args, $key ); |
| 289 | 294 | $class = implode( ' ', $args['class'] ); |
| 290 | 295 | |
| 296 | + if ( empty( $args['default'] ) && ! empty( $value ) ) { | |
| 297 | + $args['default'] = $value; | |
| 298 | + } | |
| 299 | + | |
| 291 | 300 | // Remove all classes of fields. |
| 292 | 301 | $field = preg_replace( '/class=".*?"/', '', $field, 1 ); |
| 293 | 302 | // Remove fields label. |
| 294 | 303 | $field = preg_replace( '~<label(.*?)</label>~Usi', '', $field ); |
| @@ -293,9 +302,9 @@ | ||
| 293 | 302 | // Remove fields label. |
| 294 | 303 | $field = preg_replace( '~<label(.*?)</label>~Usi', '', $field ); |
| 295 | 304 | |
| 296 | 305 | ?> |
| 297 | - <div class="<?php echo $class; ?> sellkit-checkout-fields-wrapper" id="wrapper-<?php echo $key; ?>"> | |
| 306 | + <div class="<?php echo esc_attr( $class ); ?> sellkit-checkout-fields-wrapper" id="wrapper-<?php echo esc_attr( $key ); ?>"> | |
| 298 | 307 | <?php |
| 299 | 308 | $this->label( $args ); |
| 300 | 309 | $this->field( $field, $args, $key ); |
| 301 | 310 | $this->required_validation( $args ); |