| @@ -56,9 +56,9 @@ | ||
| 56 | 56 | return $attributes; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $dimensions_block_styles = array(); |
| 60 | - $supported_features = array( 'minHeight', 'minWidth', 'height', 'width' ); | |
| 60 | + $supported_features = array( 'minHeight', 'height', 'width' ); | |
| 61 | 61 | |
| 62 | 62 | foreach ( $supported_features as $feature ) { |
| 63 | 63 | $has_support = block_has_support( $block_type, array( 'dimensions', $feature ), false ); |
| 64 | 64 | $skip_serialization = wp_should_skip_block_supports_serialization( $block_type, 'dimensions', $feature ); |
| @@ -79,24 +79,8 @@ | ||
| 79 | 79 | return $attributes; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * Checks whether an aspectRatio block-support value is explicitly set. | |
| 84 | - * | |
| 85 | - * @param mixed $aspect_ratio Aspect-ratio value. | |
| 86 | - * @return bool Whether the value is an explicit aspect ratio. | |
| 87 | - */ | |
| 88 | -function gutenberg_is_explicit_aspect_ratio_value( $aspect_ratio ) { | |
| 89 | - if ( ! is_string( $aspect_ratio ) && ! is_numeric( $aspect_ratio ) ) { | |
| 90 | - return false; | |
| 91 | - } | |
| 92 | - | |
| 93 | - $aspect_ratio = strtolower( trim( (string) $aspect_ratio ) ); | |
| 94 | - | |
| 95 | - return '' !== $aspect_ratio && 'auto' !== $aspect_ratio; | |
| 96 | -} | |
| 97 | - | |
| 98 | -/** | |
| 99 | 83 | * Renders server-side dimensions styles to the block wrapper. |
| 100 | 84 | * This block support uses the `render_block` hook to ensure that |
| 101 | 85 | * it is also applied to non-server-rendered blocks. |
| 102 | 86 | * |
| @@ -120,9 +104,9 @@ | ||
| 120 | 104 | $dimensions_block_styles['aspectRatio'] = $block_attributes['style']['dimensions']['aspectRatio'] ?? null; |
| 121 | 105 | |
| 122 | 106 | // To ensure the aspect ratio does not get overridden by `minHeight` or `height` unset any existing rule. |
| 123 | 107 | if ( |
| 124 | - gutenberg_is_explicit_aspect_ratio_value( $dimensions_block_styles['aspectRatio'] ) | |
| 108 | + isset( $dimensions_block_styles['aspectRatio'] ) | |
| 125 | 109 | ) { |
| 126 | 110 | $dimensions_block_styles['minHeight'] = 'unset'; |
| 127 | 111 | $dimensions_block_styles['height'] = 'unset'; |
| 128 | 112 | } elseif ( |
| @@ -157,9 +141,9 @@ | ||
| 157 | 141 | if ( ! empty( $styles['classnames'] ) ) { |
| 158 | 142 | foreach ( explode( ' ', $styles['classnames'] ) as $class_name ) { |
| 159 | 143 | if ( |
| 160 | 144 | str_contains( $class_name, 'aspect-ratio' ) && |
| 161 | - ! gutenberg_is_explicit_aspect_ratio_value( $block_attributes['style']['dimensions']['aspectRatio'] ?? null ) | |
| 145 | + ! isset( $block_attributes['style']['dimensions']['aspectRatio'] ) | |
| 162 | 146 | ) { |
| 163 | 147 | continue; |
| 164 | 148 | } |
| 165 | 149 | $tags->add_class( $class_name ); |