wp_has_border_feature_support example

// Setup attributes and styles within that if needed.     if ( ! $block_type->attributes ) {
        $block_type->attributes = array();
    }

    if ( block_has_support( $block_type, array( '__experimentalBorder' ) ) && ! array_key_exists( 'style', $block_type->attributes ) ) {
        $block_type->attributes['style'] = array(
            'type' => 'object',
        );
    }

    if ( wp_has_border_feature_support( $block_type, 'color' ) && ! array_key_exists( 'borderColor', $block_type->attributes ) ) {
        $block_type->attributes['borderColor'] = array(
            'type' => 'string',
        );
    }
}

/** * Adds CSS classes and inline styles for border styles to the incoming * attributes array. This will be applied to the block markup in the front-end. * * @since 5.8.0 * @since 6.1.0 Implemented the style engine to generate CSS and classnames. * @access private * * @param WP_Block_Type $block_type Block type. * @param array $block_attributes Block attributes. * @return array Border CSS classes and inline styles. */
Home | Imprint | This part of the site doesn't use cookies.