Changeset 55175
- Timestamp:
- 02/01/2023 04:13:49 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/dimensions.php
r53076 r55175 30 30 } 31 31 32 $has_dimensions_support = block_has_support( $block_type, array( '__experimentalDimensions' ), false ); 33 // Future block supports such as height & width will be added here. 32 $has_dimensions_support = block_has_support( $block_type, array( 'dimensions' ), false ); 34 33 35 34 if ( $has_dimensions_support ) { … … 45 44 * 46 45 * @since 5.9.0 46 * @since 6.2.0 Added `minHeight` support. 47 47 * @access private 48 48 * … … 52 52 */ 53 53 function wp_apply_dimensions_support( $block_type, $block_attributes ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable 54 if ( wp_should_skip_block_supports_serialization( $block_type, ' __experimentalDimensions' ) ) {54 if ( wp_should_skip_block_supports_serialization( $block_type, 'dimensions' ) ) { 55 55 return array(); 56 56 } 57 57 58 $ styles = array();58 $attributes = array(); 59 59 60 // Height support to be added in near future.61 60 // Width support to be added in near future. 62 61 63 return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) ); 62 $has_min_height_support = block_has_support( $block_type, array( 'dimensions', 'minHeight' ), false ); 63 $block_styles = isset( $block_attributes['style'] ) ? $block_attributes['style'] : null; 64 65 if ( ! $block_styles ) { 66 return $attributes; 67 } 68 69 $skip_min_height = wp_should_skip_block_supports_serialization( $block_type, 'dimensions', 'minHeight' ); 70 $dimensions_block_styles = array(); 71 $dimensions_block_styles['minHeight'] = $has_min_height_support && ! $skip_min_height ? _wp_array_get( $block_styles, array( 'dimensions', 'minHeight' ), null ) : null; 72 $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) ); 73 74 if ( ! empty( $styles['css'] ) ) { 75 $attributes['style'] = $styles['css']; 76 } 77 78 return $attributes; 64 79 } 65 80 -
trunk/src/wp-includes/class-wp-theme-json.php
r55172 r55175 193 193 * `--wp--style--root--padding-*`, and `box-shadow` properties, 194 194 * removed the `--wp--style--block-gap` property. 195 * @since 6.2.0 Added `outline-*` properties.195 * @since 6.2.0 Added `outline-*`, and `min-height` properties. 196 196 * 197 197 * @var array … … 232 232 'margin-bottom' => array( 'spacing', 'margin', 'bottom' ), 233 233 'margin-left' => array( 'spacing', 'margin', 'left' ), 234 'min-height' => array( 'dimensions', 'minHeight' ), 234 235 'outline-color' => array( 'outline', 'color' ), 235 236 'outline-offset' => array( 'outline', 'offset' ), … … 294 295 * @since 6.0.0 Added `color.defaultDuotone`. 295 296 * @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`. 297 * @since 6.2.0 Added `dimensions.minHeight`. 296 298 * @var array 297 299 */ … … 320 322 ), 321 323 'custom' => null, 324 'dimensions' => array( 325 'minHeight' => null, 326 ), 322 327 'layout' => array( 323 328 'contentSize' => null, … … 359 364 * added new property `shadow`, 360 365 * updated `blockGap` to be allowed at any level. 361 * @since 6.2.0 Added `outline` properties.366 * @since 6.2.0 Added `outline`, and `minHeight` properties. 362 367 * 363 368 * @var array … … 378 383 'gradient' => null, 379 384 'text' => null, 385 ), 386 'dimensions' => array( 387 'minHeight' => null, 380 388 ), 381 389 'filter' => array( … … 491 499 * 492 500 * @since 6.0.0 501 * @since 6.2.0 Added `dimensions.minHeight`. 493 502 * @var array 494 503 */ … … 499 508 array( 'border', 'width' ), 500 509 array( 'color', 'link' ), 510 array( 'dimensions', 'minHeight' ), 501 511 array( 'spacing', 'blockGap' ), 502 512 array( 'spacing', 'margin' ), -
trunk/src/wp-includes/style-engine/class-wp-style-engine.php
r54481 r55175 138 138 ), 139 139 ), 140 'dimensions' => array( 141 'minHeight' => array( 142 'property_keys' => array( 143 'default' => 'min-height', 144 ), 145 'path' => array( 'dimensions', 'minHeight' ), 146 'css_vars' => array( 147 'spacing' => '--wp--preset--spacing--$slug', 148 ), 149 ), 150 ), 140 151 'spacing' => array( 141 152 'padding' => array( -
trunk/tests/phpunit/tests/style-engine/styleEngine.php
r54156 r55175 167 167 ), 168 168 169 'inline_valid_dimensions_style' => array( 170 'block_styles' => array( 171 'dimensions' => array( 172 'minHeight' => '50vh', 173 ), 174 ), 175 'options' => null, 176 'expected_output' => array( 177 'css' => 'min-height:50vh;', 178 'declarations' => array( 179 'min-height' => '50vh', 180 ), 181 ), 182 ), 183 169 184 'inline_valid_typography_style' => array( 170 185 'block_styles' => array( -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r55172 r55175 242 242 'link' => true, 243 243 ), 244 'dimensions' => array( 245 'minHeight' => true, 246 ), 244 247 'spacing' => array( 245 248 'blockGap' => false, … … 265 268 'color' => array( 266 269 'link' => true, 270 ), 271 'dimensions' => array( 272 'minHeight' => true, 267 273 ), 268 274 'spacing' => array(
Note: See TracChangeset
for help on using the changeset viewer.