is_rest_api_request() ) { // In the editor we will display the placeholder, so no need to // print the markup. return ''; } $wrapper_attributes = get_block_wrapper_attributes( array( 'data-wp-interactive' => 'woocommerce/mini-cart-contents', 'data-wp-style--background-color' => 'woocommerce/mini-cart::state.contentsBackgroundColor', ) ); ob_start(); ?>
>
array( '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout', '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:hover', '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:focus', '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart.wc-block-components-button:hover', '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart.wc-block-components-button:focus', '.wc-block-mini-cart__shopping-button a:hover', '.wc-block-mini-cart__shopping-button a:focus', ), 'properties' => array( array( 'property' => 'color', 'value' => $bg_color ? $bg_color['value'] : false, ), array( 'property' => 'border-color', 'value' => $text_color ? $text_color['value'] : false, ), array( 'property' => 'background-color', 'value' => $text_color ? $text_color['value'] : false, ), ), ), ); $parsed_style = sprintf( ':root { --drawer-width: %s; --neg-drawer-width: calc(var(--drawer-width) * -1); }', esc_html( $attributes['width'] ) ); foreach ( $styles as $style ) { $selector = is_array( $style['selector'] ) ? implode( ',', $style['selector'] ) : $style['selector']; $properties = array_filter( $style['properties'], function ( $property ) { return $property['value']; } ); if ( ! empty( $properties ) ) { $parsed_style .= $selector . '{'; foreach ( $properties as $property ) { $parsed_style .= sprintf( '%1$s:%2$s;', $property['property'], $property['value'] ); } $parsed_style .= '}'; } } wp_add_inline_style( 'wc-blocks-style', $parsed_style ); } /** * Get list of Mini-Cart Contents block & its inner-block types. * * @return array; */ public static function get_mini_cart_block_types() { $block_types = []; $block_types[] = 'MiniCartContents'; $block_types[] = 'EmptyMiniCartContentsBlock'; $block_types[] = 'FilledMiniCartContentsBlock'; $block_types[] = 'MiniCartFooterBlock'; $block_types[] = 'MiniCartItemsBlock'; $block_types[] = 'MiniCartProductsTableBlock'; $block_types[] = 'MiniCartShoppingButtonBlock'; $block_types[] = 'MiniCartCartButtonBlock'; $block_types[] = 'MiniCartCheckoutButtonBlock'; $block_types[] = 'MiniCartTitleBlock'; $block_types[] = 'MiniCartTitleItemsCounterBlock'; $block_types[] = 'MiniCartTitleLabelBlock'; return $block_types; } }