| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | if ( array_key_exists( 'style', $block_type->attributes ) ) { |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $has_dimensions_support = gutenberg_block_has_support( $block_type, array( '__experimentalDimensions' ), false ); | |
| 28 | + $has_dimensions_support = block_has_support( $block_type, array( '__experimentalDimensions' ), false ); | |
| 29 | 29 | // Future block supports such as height & width will be added here. |
| 30 | 30 | |
| 31 | 31 | if ( $has_dimensions_support ) { |
| 32 | 32 | $block_type->attributes['style'] = array( |
| @@ -44,9 +44,9 @@ | ||
| 44 | 44 | * |
| 45 | 45 | * @return array Block dimensions CSS classes and inline styles. |
| 46 | 46 | */ |
| 47 | 47 | function gutenberg_apply_dimensions_support( $block_type, $block_attributes ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 48 | - if ( gutenberg_skip_dimensions_serialization( $block_type ) ) { | |
| 48 | + if ( gutenberg_should_skip_block_supports_serialization( $block_type, '__experimentalDimensions' ) ) { | |
| 49 | 49 | return array(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $styles = array(); |
| @@ -54,23 +54,8 @@ | ||
| 54 | 54 | // Height support to be added in near future. |
| 55 | 55 | // Width support to be added in near future. |
| 56 | 56 | |
| 57 | 57 | return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) ); |
| 58 | -} | |
| 59 | - | |
| 60 | -/** | |
| 61 | - * Checks whether serialization of the current block's dimensions properties | |
| 62 | - * should occur. | |
| 63 | - * | |
| 64 | - * @param WP_Block_type $block_type Block type. | |
| 65 | - * | |
| 66 | - * @return boolean Whether to serialize spacing support styles & classes. | |
| 67 | - */ | |
| 68 | -function gutenberg_skip_dimensions_serialization( $block_type ) { | |
| 69 | - $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false ); | |
| 70 | - return is_array( $dimensions_support ) && | |
| 71 | - array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) && | |
| 72 | - $dimensions_support['__experimentalSkipSerialization']; | |
| 73 | 58 | } |
| 74 | 59 | |
| 75 | 60 | // Register the block support. |
| 76 | 61 | WP_Block_Supports::get_instance()->register( |