Changeset 53076 for trunk/src/wp-includes/block-supports/spacing.php
- Timestamp:
- 04/05/2022 12:06:48 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/block-supports/spacing.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/spacing.php
r52434 r53076 45 45 */ 46 46 function wp_apply_spacing_support( $block_type, $block_attributes ) { 47 if ( wp_s kip_spacing_serialization( $block_type) ) {47 if ( wp_should_skip_block_supports_serialization( $block_type, 'spacing' ) ) { 48 48 return array(); 49 49 } … … 51 51 $has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false ); 52 52 $has_margin_support = block_has_support( $block_type, array( 'spacing', 'margin' ), false ); 53 $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' ); 54 $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' ); 53 55 $styles = array(); 54 56 55 if ( $has_padding_support ) {57 if ( $has_padding_support && ! $skip_padding ) { 56 58 $padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null ); 57 59 if ( is_array( $padding_value ) ) { … … 64 66 } 65 67 66 if ( $has_margin_support ) {68 if ( $has_margin_support && ! $skip_margin ) { 67 69 $margin_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'margin' ), null ); 68 70 if ( is_array( $margin_value ) ) { … … 78 80 } 79 81 80 /**81 * Checks whether serialization of the current block's spacing properties should82 * occur.83 *84 * @since 5.9.085 * @access private86 *87 * @param WP_Block_Type $block_type Block type.88 * @return bool Whether to serialize spacing support styles & classes.89 */90 function wp_skip_spacing_serialization( $block_type ) {91 $spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false );92 93 return is_array( $spacing_support ) &&94 array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&95 $spacing_support['__experimentalSkipSerialization'];96 }97 98 82 // Register the block support. 99 83 WP_Block_Supports::get_instance()->register(
Note: See TracChangeset
for help on using the changeset viewer.