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-radio/block.php +11 -12 2.9.0 → 2.14.0 View file →
@@ -19,9 +19,10 @@
19 19 $css_generator->add_class_styles(
20 20 '{{WRAPPER}}',
21 21 $this->get_wrapper_css( $attributes ),
22 22 $this->get_wrapper_css( $attributes, 'Tablet' ),
23 - $this->get_wrapper_css( $attributes, 'Mobile' )
23 + $this->get_wrapper_css( $attributes, 'Mobile' ),
24 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_wrapper_css( $attributes, $device ); } )
24 25 );
25 26 $css_generator->add_class_styles(
26 27 '{{WRAPPER}}.ablocks-block--form-radio',
27 28 $this->get_input_block_main_wrapper( $attributes ),
@@ -31,9 +32,10 @@
31 32 $css_generator->add_class_styles(
32 33 '{{WRAPPER}} .ablocks-form-builder__radio-option',
33 34 $this->get_radio_dynamic_width_css( $attributes ),
34 35 $this->get_radio_dynamic_width_css( $attributes, 'Tablet' ),
35 - $this->get_radio_dynamic_width_css( $attributes, 'Mobile' )
36 + $this->get_radio_dynamic_width_css( $attributes, 'Mobile' ),
37 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_radio_dynamic_width_css( $attributes, $device ); } )
36 38 );
37 39 return $css_generator->generate_css();
38 40 }
39 41 public function get_radio_dynamic_width_css( $attributes, $device = '' ) {
@@ -49,18 +51,15 @@
49 51 public function get_input_block_main_wrapper( $attributes, $device = '' ) {
50 52 $css = [];
51 53 $css['box-sizing'] = 'border-box';
52 54
53 - $valueKey = $device === 'Tablet' ? 'valueTablet' : ( $device === 'Mobile' ? 'valueMobile' : 'value' );
54 - $unitKey = $device === 'Tablet' ? 'valueUnitTablet' : ( $device === 'Mobile' ? 'valueUnitMobile' : 'valueUnit' );
55 -
56 - $widthValue = isset( $attributes['inputWidth'][ $valueKey ] ) && $attributes['inputWidth'][ $valueKey ] !== ''
57 - ? $attributes['inputWidth'][ $valueKey ]
58 - : ( isset( $attributes['inputWidth']['value'] ) ? $attributes['inputWidth']['value'] : 100 );
59 -
60 - $widthUnit = isset( $attributes['inputWidth'][ $unitKey ] ) && $attributes['inputWidth'][ $unitKey ] !== ''
61 - ? $attributes['inputWidth'][ $unitKey ]
62 - : '%';
55 + // The device's own width, else the nearest containing wider device's
56 + // (custom breakpoints included), else Desktop's.
57 + $input_width = isset( $attributes['inputWidth'] ) ? (array) $attributes['inputWidth'] : [];
58 + $widthValue = \ABlocks\Helper::get_responsive_value( $input_width, 'value', $device );
59 + $widthValue = false === $widthValue ? 100 : $widthValue;
60 + $widthUnit = \ABlocks\Helper::get_responsive_value( $input_width, 'valueUnit', $device );
61 + $widthUnit = false === $widthUnit ? '%' : $widthUnit;
63 62
64 63 if ( is_numeric( $widthValue ) ) {
65 64 $widthValue = max( 0, floatval( $widthValue ) - 1 );
66 65 }