Skip to content

Commit

Permalink
This commit reinstates the deprecated functions that were removed in W…
Browse files Browse the repository at this point in the history
…ordPress#2500 and adds a deprecation notice for each.
  • Loading branch information
ramonjd committed Apr 6, 2022
1 parent 10b258f commit 8cafacf
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/wp-includes/block-supports/border.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ function wp_apply_border_support( $block_type, $block_attributes ) {
return $attributes;
}

/**
* Checks whether serialization of the current block's border properties should
* occur.
*
* @since 5.8.0
* @access private
* @deprecated 6.0.0
*
* @param WP_Block_Type $block_type Block type.
* @return bool Whether serialization of the current block's border properties
* should occur.
*/
function wp_skip_border_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0' );
$border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false );

return is_array( $border_support ) &&
array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
$border_support['__experimentalSkipSerialization'];
}

/**
* Checks whether the current block type supports the border feature requested.
*
Expand Down
19 changes: 19 additions & 0 deletions src/wp-includes/block-supports/dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ function wp_apply_dimensions_support( $block_type, $block_attributes ) { // phpc
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
}

/**
* Checks whether serialization of the current block's dimensions properties
* should occur.
*
* @since 5.9.0
* @access private
* @deprecated 6.0.0
*
* @param WP_Block_type $block_type Block type.
* @return bool Whether to serialize spacing support styles & classes.
*/
function wp_skip_dimensions_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0' );
$dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false );
return is_array( $dimensions_support ) &&
array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
$dimensions_support['__experimentalSkipSerialization'];
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'dimensions',
Expand Down
20 changes: 20 additions & 0 deletions src/wp-includes/block-supports/spacing.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@ function wp_apply_spacing_support( $block_type, $block_attributes ) {
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
}

/**
* Checks whether serialization of the current block's spacing properties should
* occur.
*
* @since 5.9.0
* @access private
* @deprecated 6.0.0
*
* @param WP_Block_Type $block_type Block type.
* @return bool Whether to serialize spacing support styles & classes.
*/
function wp_skip_spacing_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0' );
$spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false );

return is_array( $spacing_support ) &&
array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
$spacing_support['__experimentalSkipSerialization'];
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'spacing',
Expand Down

0 comments on commit 8cafacf

Please sign in to comment.