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-checkbox/block.php +9 -11 2.12.0 → 2.14.0 View file →
@@ -20,9 +20,10 @@
20 20 $css_generator->add_class_styles(
21 21 '{{WRAPPER}}',
22 22 $this->get_wrapper_css( $attributes ),
23 23 $this->get_wrapper_css( $attributes, 'Tablet' ),
24 - $this->get_wrapper_css( $attributes, 'Mobile' )
24 + $this->get_wrapper_css( $attributes, 'Mobile' ),
25 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_wrapper_css( $attributes, $device ); } )
25 26 );
26 27 $css_generator->add_class_styles(
27 28 '{{WRAPPER}}.ablocks-block--form-checkbox',
28 29 $this->get_input_block_main_wrapper( $attributes ),
@@ -38,18 +39,15 @@
38 39 public function get_input_block_main_wrapper( $attributes, $device = '' ) {
39 40 $css = [];
40 41 $css['box-sizing'] = 'border-box';
41 42
42 - $valueKey = $device === 'Tablet' ? 'valueTablet' : ( $device === 'Mobile' ? 'valueMobile' : 'value' );
43 - $unitKey = $device === 'Tablet' ? 'valueUnitTablet' : ( $device === 'Mobile' ? 'valueUnitMobile' : 'valueUnit' );
44 -
45 - $widthValue = isset( $attributes['inputWidth'][ $valueKey ] ) && $attributes['inputWidth'][ $valueKey ] !== ''
46 - ? $attributes['inputWidth'][ $valueKey ]
47 - : ( isset( $attributes['inputWidth']['value'] ) ? $attributes['inputWidth']['value'] : 100 );
48 -
49 - $widthUnit = isset( $attributes['inputWidth'][ $unitKey ] ) && $attributes['inputWidth'][ $unitKey ] !== ''
50 - ? $attributes['inputWidth'][ $unitKey ]
51 - : '%';
43 + // The device's own width, else the nearest containing wider device's
44 + // (custom breakpoints included), else Desktop's.
45 + $input_width = isset( $attributes['inputWidth'] ) ? (array) $attributes['inputWidth'] : [];
46 + $widthValue = \ABlocks\Helper::get_responsive_value( $input_width, 'value', $device );
47 + $widthValue = false === $widthValue ? 100 : $widthValue;
48 + $widthUnit = \ABlocks\Helper::get_responsive_value( $input_width, 'valueUnit', $device );
49 + $widthUnit = false === $widthUnit ? '%' : $widthUnit;
52 50
53 51 if ( is_numeric( $widthValue ) ) {
54 52 $widthValue = max( 0, floatval( $widthValue ) - 1 );
55 53 }