Make WordPress Core


Ignore:
Timestamp:
04/05/2022 12:06:48 PM (4 years ago)
Author:
gziolo
Message:

Editor: Backport block support changes from the Gutenberg plugin

Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.

Related changes in Gutenberg:

Props ramonopoly, aaronrobertshaw.
See #55505.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/dimensions.php

    r52302 r53076  
    55 * This does not include the `spacing` block support even though that visually
    66 * appears under the "Dimensions" panel in the editor. It remains in its
    7  * original `spacing.php` file for backwards compatibility.
     7 * original `spacing.php` file for compatibility with core.
    88 *
    99 * @package WordPress
     
    5252 */
    5353function wp_apply_dimensions_support( $block_type, $block_attributes ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
    54     if ( wp_skip_dimensions_serialization( $block_type ) ) {
     54    if ( wp_should_skip_block_supports_serialization( $block_type, '__experimentalDimensions' ) ) {
    5555        return array();
    5656    }
     
    6464}
    6565
    66 /**
    67  * Checks whether serialization of the current block's dimensions properties
    68  * should occur.
    69  *
    70  * @since 5.9.0
    71  * @access private
    72  *
    73  * @param WP_Block_type $block_type Block type.
    74  * @return bool Whether to serialize spacing support styles & classes.
    75  */
    76 function wp_skip_dimensions_serialization( $block_type ) {
    77     $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false );
    78     return is_array( $dimensions_support ) &&
    79         array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
    80         $dimensions_support['__experimentalSkipSerialization'];
    81 }
    82 
    8366// Register the block support.
    8467WP_Block_Supports::get_instance()->register(
Note: See TracChangeset for help on using the changeset viewer.