Changeset 55175 for trunk/src/wp-includes/block-supports/dimensions.php
- Timestamp:
- 02/01/2023 04:13:49 PM (4 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)