PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | includes/blocks/form-password/block.php +13 -13 2.13.1 → 2.14.0 View file →
@@ -23,9 +23,10 @@
23 23 $css_generator->add_class_styles(
24 24 '{{WRAPPER}}',
25 25 $this->get_wrapper_css( $attributes ),
26 26 $this->get_wrapper_css( $attributes, 'Tablet' ),
27 - $this->get_wrapper_css( $attributes, 'Mobile' )
27 + $this->get_wrapper_css( $attributes, 'Mobile' ),
28 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_wrapper_css( $attributes, $device ); } )
28 29 );
29 30 $css_generator->add_class_styles(
30 31 '{{WRAPPER}}.ablocks-block--form-password',
31 32 $this->get_input_block_main_wrapper( $attributes ),
@@ -37,9 +38,10 @@
37 38 $css_generator->add_class_styles(
38 39 '{{WRAPPER}} .ablocks-form-builder__input-icon .ablocks-icon-wrap',
39 40 $this->get_icon_wrapper_css( $attributes ),
40 41 $this->get_icon_wrapper_css( $attributes, 'Tablet' ),
41 - $this->get_icon_wrapper_css( $attributes, 'Mobile' )
42 + $this->get_icon_wrapper_css( $attributes, 'Mobile' ),
43 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_wrapper_css( $attributes, $device ); } )
42 44 );
43 45
44 46 $css_generator->add_class_styles(
45 47 '{{WRAPPER}} .ablocks-form-builder__input-show-icon',
@@ -44,9 +46,10 @@
44 46 $css_generator->add_class_styles(
45 47 '{{WRAPPER}} .ablocks-form-builder__input-show-icon',
46 48 $this->get_icon_space_css( $attributes ),
47 49 $this->get_icon_space_css( $attributes, 'Tablet' ),
48 - $this->get_icon_space_css( $attributes, 'Mobile' )
50 + $this->get_icon_space_css( $attributes, 'Mobile' ),
51 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_space_css( $attributes, $device ); } )
49 52 );
50 53 $css_generator->add_class_styles(
51 54 '{{WRAPPER}} .ablocks-form-builder__input-toggle-password .ablocks-icon-wrap ',
52 55 $this->get_password_show_hide_icon_wrapper_css( $attributes )
@@ -61,18 +64,15 @@
61 64 public function get_input_block_main_wrapper( $attributes, $device = '' ) {
62 65 $css = [];
63 66 $css['box-sizing'] = 'border-box';
64 67
65 - $valueKey = $device === 'Tablet' ? 'valueTablet' : ( $device === 'Mobile' ? 'valueMobile' : 'value' );
66 - $unitKey = $device === 'Tablet' ? 'valueUnitTablet' : ( $device === 'Mobile' ? 'valueUnitMobile' : 'valueUnit' );
67 -
68 - $widthValue = isset( $attributes['inputWidth'][ $valueKey ] ) && $attributes['inputWidth'][ $valueKey ] !== ''
69 - ? $attributes['inputWidth'][ $valueKey ]
70 - : ( isset( $attributes['inputWidth']['value'] ) ? $attributes['inputWidth']['value'] : 100 );
71 -
72 - $widthUnit = isset( $attributes['inputWidth'][ $unitKey ] ) && $attributes['inputWidth'][ $unitKey ] !== ''
73 - ? $attributes['inputWidth'][ $unitKey ]
74 - : '%';
68 + // The device's own width, else the nearest containing wider device's
69 + // (custom breakpoints included), else Desktop's.
70 + $input_width = isset( $attributes['inputWidth'] ) ? (array) $attributes['inputWidth'] : [];
71 + $widthValue = \ABlocks\Helper::get_responsive_value( $input_width, 'value', $device );
72 + $widthValue = false === $widthValue ? 100 : $widthValue;
73 + $widthUnit = \ABlocks\Helper::get_responsive_value( $input_width, 'valueUnit', $device );
74 + $widthUnit = false === $widthUnit ? '%' : $widthUnit;
75 75
76 76 if ( is_numeric( $widthValue ) ) {
77 77 $widthValue = max( 0, floatval( $widthValue ) - 1 );
78 78 }