Accordion
1 year ago
AddToCartWithOptions
2 weeks ago
OrderConfirmation
2 weeks ago
ProductCollection
2 weeks ago
Reviews
2 weeks ago
AbstractBlock.php
2 weeks ago
AbstractDynamicBlock.php
2 years ago
AbstractInnerBlock.php
1 year ago
AbstractProductGrid.php
5 months ago
ActiveFilters.php
2 years ago
AddToCartForm.php
2 weeks ago
AddToWishlistButton.php
2 months ago
AllProducts.php
1 month ago
AllReviews.php
2 years ago
AtomicBlock.php
2 years ago
AttributeFilter.php
1 year ago
Breadcrumbs.php
1 month ago
Cart.php
2 weeks ago
CartAcceptedPaymentMethodsBlock.php
2 years ago
CartCrossSellsBlock.php
2 years ago
CartCrossSellsProductsBlock.php
2 years ago
CartExpressPaymentBlock.php
1 year ago
CartItemsBlock.php
2 years ago
CartLineItemsBlock.php
2 years ago
CartLink.php
3 months ago
CartOrderSummaryBlock.php
2 years ago
CartOrderSummaryCouponFormBlock.php
2 years ago
CartOrderSummaryDiscountBlock.php
2 years ago
CartOrderSummaryFeeBlock.php
2 years ago
CartOrderSummaryHeadingBlock.php
2 years ago
CartOrderSummaryShippingBlock.php
2 years ago
CartOrderSummarySubtotalBlock.php
2 years ago
CartOrderSummaryTaxesBlock.php
2 years ago
CartOrderSummaryTotalsBlock.php
2 years ago
CartTotalsBlock.php
2 years ago
CatalogSorting.php
2 months ago
CategoryDescription.php
3 months ago
CategoryTitle.php
3 months ago
Checkout.php
2 weeks ago
CheckoutActionsBlock.php
1 year ago
CheckoutAdditionalInformationBlock.php
2 years ago
CheckoutBillingAddressBlock.php
2 years ago
CheckoutContactInformationBlock.php
2 years ago
CheckoutExpressPaymentBlock.php
10 months ago
CheckoutFieldsBlock.php
2 years ago
CheckoutOrderNoteBlock.php
2 years ago
CheckoutOrderSummaryBlock.php
2 years ago
CheckoutOrderSummaryCartItemsBlock.php
2 years ago
CheckoutOrderSummaryCouponFormBlock.php
2 years ago
CheckoutOrderSummaryDiscountBlock.php
2 years ago
CheckoutOrderSummaryFeeBlock.php
2 years ago
CheckoutOrderSummaryShippingBlock.php
2 years ago
CheckoutOrderSummarySubtotalBlock.php
2 years ago
CheckoutOrderSummaryTaxesBlock.php
2 years ago
CheckoutOrderSummaryTotalsBlock.php
2 years ago
CheckoutPaymentBlock.php
2 years ago
CheckoutPickupOptionsBlock.php
2 years ago
CheckoutShippingAddressBlock.php
2 years ago
CheckoutShippingMethodBlock.php
2 years ago
CheckoutShippingMethodsBlock.php
2 years ago
CheckoutTermsBlock.php
2 years ago
CheckoutTotalsBlock.php
2 years ago
ClassicShortcode.php
1 year ago
ClassicTemplate.php
6 months ago
ComingSoon.php
1 year ago
CouponCode.php
2 weeks ago
CustomerAccount.php
2 weeks ago
Dropdown.php
1 month ago
EmailContent.php
2 weeks ago
EmptyCartBlock.php
2 years ago
EmptyMiniCartContentsBlock.php
2 weeks ago
EnableBlockJsonAssetsTrait.php
1 year ago
FeaturedCategory.php
2 weeks ago
FeaturedItem.php
2 weeks ago
FeaturedProduct.php
2 weeks ago
FilledCartBlock.php
2 years ago
FilledMiniCartContentsBlock.php
2 weeks ago
FilterWrapper.php
2 years ago
HandpickedProducts.php
1 year ago
MiniCart.php
2 weeks ago
MiniCartCartButtonBlock.php
2 weeks ago
MiniCartCheckoutButtonBlock.php
2 weeks ago
MiniCartContents.php
2 weeks ago
MiniCartFooterBlock.php
2 weeks ago
MiniCartItemsBlock.php
2 weeks ago
MiniCartProductsTableBlock.php
2 weeks ago
MiniCartShoppingButtonBlock.php
2 weeks ago
MiniCartTitleBlock.php
2 weeks ago
MiniCartTitleItemsCounterBlock.php
2 weeks ago
MiniCartTitleLabelBlock.php
2 weeks ago
NextPreviousButtons.php
7 months ago
PageContentWrapper.php
2 years ago
PaymentMethodIcons.php
1 year ago
PriceFilter.php
1 year ago
ProceedToCheckoutBlock.php
2 years ago
ProductAverageRating.php
1 year ago
ProductBestSellers.php
2 years ago
ProductButton.php
2 weeks ago
ProductCategories.php
2 months ago
ProductCategory.php
2 years ago
ProductDescription.php
10 months ago
ProductDetails.php
7 months ago
ProductFilterActive.php
2 months ago
ProductFilterAttribute.php
1 month ago
ProductFilterCheckboxList.php
2 months ago
ProductFilterChips.php
2 months ago
ProductFilterClearButton.php
2 months ago
ProductFilterPrice.php
2 months ago
ProductFilterPriceSlider.php
2 months ago
ProductFilterRating.php
2 months ago
ProductFilterRemovableChips.php
2 months ago
ProductFilterStatus.php
1 month ago
ProductFilterTaxonomy.php
1 month ago
ProductFilters.php
1 month ago
ProductGallery.php
2 weeks ago
ProductGalleryLargeImage.php
2 weeks ago
ProductGalleryThumbnails.php
2 weeks ago
ProductImage.php
2 weeks ago
ProductImageGallery.php
9 months ago
ProductMeta.php
2 years ago
ProductNew.php
2 years ago
ProductOnSale.php
2 years ago
ProductPrice.php
2 weeks ago
ProductQuery.php
1 month ago
ProductRating.php
1 year ago
ProductRatingCounter.php
1 year ago
ProductRatingStars.php
1 year ago
ProductResultsCount.php
3 months ago
ProductSKU.php
3 months ago
ProductSaleBadge.php
1 year ago
ProductSearch.php
1 year ago
ProductSpecifications.php
3 months ago
ProductStockIndicator.php
3 months ago
ProductSummary.php
3 weeks ago
ProductTag.php
2 years ago
ProductTemplate.php
1 month ago
ProductTitle.php
1 year ago
ProductTopRated.php
2 years ago
ProductsByAttribute.php
2 years ago
RatingFilter.php
2 years ago
RelatedProducts.php
5 months ago
ReviewsByCategory.php
2 years ago
ReviewsByProduct.php
2 years ago
SavedForLater.php
2 months ago
SingleProduct.php
2 weeks ago
StockFilter.php
2 weeks ago
StoreNotices.php
1 year ago
Wishlist.php
2 months ago
FilledMiniCartContentsBlock.php
94 lines
| 1 | <?php |
| 2 | namespace Automattic\WooCommerce\Blocks\BlockTypes; |
| 3 | |
| 4 | use Automattic\WooCommerce\Blocks\Utils\BlocksSharedState; |
| 5 | |
| 6 | /** |
| 7 | * FilledMiniCartContentsBlock class. |
| 8 | */ |
| 9 | class FilledMiniCartContentsBlock extends AbstractInnerBlock { |
| 10 | /** |
| 11 | * Block name. |
| 12 | * |
| 13 | * @var string |
| 14 | */ |
| 15 | protected $block_name = 'filled-mini-cart-contents-block'; |
| 16 | |
| 17 | /** |
| 18 | * Render the markup for the Filled Mini-Cart Contents block. |
| 19 | * |
| 20 | * @param array $attributes Block attributes. |
| 21 | * @param string $content Block content. |
| 22 | * @param \WP_Block $block Block instance. |
| 23 | * @return string Rendered block type output. |
| 24 | */ |
| 25 | protected function render( $attributes, $content, $block ) { |
| 26 | $consent = 'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WooCommerce'; |
| 27 | $notices = BlocksSharedState::get_cart_error_notices( $consent ); |
| 28 | |
| 29 | $context = wp_json_encode( |
| 30 | array( |
| 31 | 'notices' => $notices, |
| 32 | ), |
| 33 | JSON_NUMERIC_CHECK |
| 34 | | JSON_HEX_TAG |
| 35 | | JSON_HEX_APOS |
| 36 | | JSON_HEX_QUOT |
| 37 | | JSON_HEX_AMP |
| 38 | ); |
| 39 | |
| 40 | $wrapper_attributes = get_block_wrapper_attributes( |
| 41 | array( |
| 42 | 'data-wp-interactive' => 'woocommerce/mini-cart', |
| 43 | 'data-wp-context' => 'woocommerce/store-notices::' . $context, |
| 44 | 'data-wp-bind--hidden' => 'state.cartIsEmpty', |
| 45 | ) |
| 46 | ); |
| 47 | |
| 48 | $dismiss_aria_label = __( 'Dismiss this notice', 'woocommerce' ); |
| 49 | |
| 50 | ob_start(); |
| 51 | ?> |
| 52 | <div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> |
| 53 | <div |
| 54 | class="wc-block-components-notices" |
| 55 | data-wp-interactive="woocommerce/store-notices" |
| 56 | ><template |
| 57 | data-wp-each--notice="context.notices" |
| 58 | data-wp-each-key="context.notice.id" |
| 59 | > |
| 60 | <div |
| 61 | class="wc-block-components-notice-banner" |
| 62 | data-wp-class--is-error="state.isError" |
| 63 | data-wp-class--is-success="state.isSuccess" |
| 64 | data-wp-class--is-info="state.isInfo" |
| 65 | data-wp-class--is-dismissible="context.notice.dismissible" |
| 66 | data-wp-bind--role="state.role" |
| 67 | data-wp-watch="callbacks.injectIcon" |
| 68 | > |
| 69 | <div class="wc-block-components-notice-banner__content"> |
| 70 | <span data-wp-init="callbacks.renderNoticeContent"></span> |
| 71 | </div> |
| 72 | <button |
| 73 | data-wp-bind--hidden="!context.notice.dismissible" |
| 74 | class="wc-block-components-button wp-element-button wc-block-components-notice-banner__dismiss contained" |
| 75 | aria-label="<?php echo esc_attr( $dismiss_aria_label ); ?>" |
| 76 | data-wp-on--click="actions.removeNotice" |
| 77 | > |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> |
| 79 | <path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" /> |
| 80 | </svg> |
| 81 | </button> |
| 82 | </div> |
| 83 | </template> |
| 84 | </div> |
| 85 | <?php |
| 86 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 87 | echo $content; |
| 88 | ?> |
| 89 | </div> |
| 90 | <?php |
| 91 | return (string) ob_get_clean(); |
| 92 | } |
| 93 | } |
| 94 |