wp_should_skip_block_supports_serialization example


function wp_apply_spacing_support( $block_type$block_attributes ) {
    if ( wp_should_skip_block_supports_serialization( $block_type, 'spacing' ) ) {
        return array();
    }

    $attributes          = array();
    $has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
    $has_margin_support  = block_has_support( $block_type, array( 'spacing', 'margin' ), false );
    $block_styles        = isset( $block_attributes['style'] ) ? $block_attributes['style'] : null;

    if ( ! $block_styles ) {
        return $attributes;
    }

    

function wp_apply_border_support( $block_type$block_attributes ) {
    if ( wp_should_skip_block_supports_serialization( $block_type, 'border' ) ) {
        return array();
    }

    $border_block_styles      = array();
    $has_border_color_support = wp_has_border_feature_support( $block_type, 'color' );
    $has_border_width_support = wp_has_border_feature_support( $block_type, 'width' );

    // Border radius.     if (
        wp_has_border_feature_support( $block_type, 'radius' ) &&
        isset( $block_attributes['style']['border']['radius'] ) &&
        !

function wp_render_elements_support( $block_content$block ) {
    if ( ! $block_content ) {
        return $block_content;
    }

    $block_type                    = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
    $skip_link_color_serialization = wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' );

    if ( $skip_link_color_serialization ) {
        return $block_content;
    }

    $link_color = null;
    if ( ! empty( $block['attrs'] ) ) {
        $link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null );
    }

    $hover_link_color = null;
    

function wp_apply_colors_support( $block_type$block_attributes ) {
    $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );

    if (
        is_array( $color_support ) &&
        wp_should_skip_block_supports_serialization( $block_type, 'color' )
    ) {
        return array();
    }

    $has_text_colors_support       = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
    $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
    $has_gradients_support         = _wp_array_get( $color_support, array( 'gradients' ), false );
    $color_block_styles            = array();

    // Text colors.     if ( $has_text_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'text' ) ) {
        
 else {
            $gap_value = $gap_value && preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
        }

        $fallback_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), '0.5em' );
        $block_spacing      = _wp_array_get( $block, array( 'attrs', 'style', 'spacing' ), null );

        /* * If a block's block.json skips serialization for spacing or spacing.blockGap, * don't apply the user-defined value to the styles. */
        $should_skip_gap_serialization = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'blockGap' );

        $block_gap             = _wp_array_get( $global_settings, array( 'spacing', 'blockGap' ), null );
        $has_block_gap_support = isset( $block_gap );

        $style = wp_get_layout_style(
            ".$container_class.$container_class",
            $used_layout,
            $has_block_gap_support,
            $gap_value,
            $should_skip_gap_serialization,
            $fallback_gap_value,
            

function wp_apply_dimensions_support( $block_type$block_attributes ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable     if ( wp_should_skip_block_supports_serialization( $block_type, 'dimensions' ) ) {
        return array();
    }

    $attributes = array();

    // Width support to be added in near future.
    $has_min_height_support = block_has_support( $block_type, array( 'dimensions', 'minHeight' ), false );
    $block_styles           = isset( $block_attributes['style'] ) ? $block_attributes['style'] : null;

    if ( ! $block_styles ) {
        

function wp_apply_typography_support( $block_type$block_attributes ) {
    if ( ! property_exists( $block_type, 'supports' ) ) {
        return array();
    }

    $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false );
    if ( ! $typography_supports ) {
        return array();
    }

    if ( wp_should_skip_block_supports_serialization( $block_type, 'typography' ) ) {
        return array();
    }

    $has_font_family_support     = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );
    $has_font_size_support       = _wp_array_get( $typography_supports, array( 'fontSize' ), false );
    $has_font_style_support      = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );
    $has_font_weight_support     = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false );
    $has_letter_spacing_support  = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );
    $has_line_height_support     = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );
    $has_text_columns_support    = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
    $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
    
Home | Imprint | This part of the site doesn't use cookies.