array( 'data' => array( 'a11y' => array( 'slideRole' => null, 'containerRole' => null, ), 'spaceBetween' => 10, 'slidesPerView' => 1, 'breakpoints' => array( '1000' => array( 'slidesPerView' => 2, ), ), ), ), ); return $data; } /** * Override Gutenberg code to render post featured image. * Return placeholder when there is no featured image. */ public function render_callback( $attributes, $content, $block ) { $post_id = $block->context['postId']; if ( ! isset( $post_id ) ) { return ''; } global $product; $previous_product = $product; $product = wc_get_product( $post_id ); if ( ! $product instanceof \WC_Product ) { $product = $previous_product; return ''; } if ( class_exists( 'WC_Frontend_Scripts' ) ) { $frontend_scripts = new \WC_Frontend_Scripts(); $frontend_scripts::load_scripts(); } ob_start(); woocommerce_show_product_sale_flash(); $sale_badge_html = ob_get_clean(); ob_start(); woocommerce_show_product_images(); $product_image_gallery_html = ob_get_clean(); $can_editable = ! empty( $attributes['className'] ) && false !== strpos( $attributes['className'], 'brandy-product-image-gallery' ); $navigation = '
'; $product = $previous_product; $classname = $attributes['className'] ?? ''; $content = sprintf( '