PATH:
home
/
ediuae
/
agrivaingredients.com
/
wp-content
/
plugins
/
woocommerce
/
src
/
Blocks
/
BlockTypes
<?php namespace Automattic\WooCommerce\Blocks\BlockTypes; /** * CartOrderSummaryBlock class. */ class CartOrderSummaryBlock extends AbstractInnerBlock { /** * Block name. * * @var string */ protected $block_name = 'cart-order-summary-block'; /** * Get the contents of the given inner block. * * @param string $block_name Name of the order summary inner block. * @param string $content The content to search. * @return array|bool */ private function get_inner_block_content( $block_name, $content ) { if ( preg_match( $this->inner_block_regex( $block_name ), $content, $matches ) ) { return $matches[0]; } return false; } /** * Get the regex that will return an inner block. * * @param string $block_name Name of the order summary inner block. * @return string Regex pattern. */ private function inner_block_regex( $block_name ) { return '/<div data-block-name="woocommerce\/cart-order-summary-' . $block_name . '-block"(.+?)>(.*?)<\/div>/si'; } /** * Render the Cart Order Summary block. * * @param array $attributes Block attributes. * @param string $content Block content. * @param object $block Block object. * @return string Rendered block. */ protected function render( $attributes, $content, $block ) { // The order-summary-totals block was introduced as a new parent block for the totals // (subtotal, discount, fees, shipping and taxes) blocks. $regex_for_cart_order_summary_totals = '/<div data-block-name="woocommerce\/cart-order-summary-totals-block"(.+?)>/'; $order_summary_totals_content = '<div data-block-name="woocommerce/cart-order-summary-totals-block" class="wp-block-woocommerce-cart-order-summary-totals-block">'; $totals_inner_blocks = array( 'subtotal', 'discount', 'fee', 'shipping', 'taxes' ); // We want to move these blocks inside a parent 'totals' block. if ( preg_match( $regex_for_cart_order_summary_totals, $content ) ) { return $content; } foreach ( $totals_inner_blocks as $key => $block_name ) { $inner_block_content = $this->get_inner_block_content( $block_name, $content ); if ( $inner_block_content ) { $order_summary_totals_content .= "\n" . $inner_block_content; // The last block is replaced with the totals block. if ( count( $totals_inner_blocks ) - 1 === $key ) { $order_summary_totals_content .= '</div>'; $content = preg_replace( $this->inner_block_regex( $block_name ), $order_summary_totals_content, $content ); } else { // Otherwise, remove the block. $content = preg_replace( $this->inner_block_regex( $block_name ), '', $content ); } } } return preg_replace( '/\n\n( *?)/i', '', $content ); } }
[+]
..
[-] CartItemsBlock.php
[edit]
[-] AllReviews.php
[edit]
[-] ProductFilterClearButton.php
[edit]
[-] CartOrderSummaryFeeBlock.php
[edit]
[-] CartCrossSellsBlock.php
[edit]
[-] CheckoutBillingAddressBlock.php
[edit]
[-] CartOrderSummaryTaxesBlock.php
[edit]
[-] ProductTag.php
[edit]
[-] CartExpressPaymentBlock.php
[edit]
[-] AbstractProductGrid.php
[edit]
[-] ProductSummary.php
[edit]
[-] AbstractBlock.php
[edit]
[-] CheckoutActionsBlock.php
[edit]
[-] CheckoutExpressPaymentBlock.php
[edit]
[-] ReviewsByCategory.php
[edit]
[-] CheckoutOrderSummaryBlock.php
[edit]
[-] ProductGalleryThumbnails.php
[edit]
[-] MiniCartTitleLabelBlock.php
[edit]
[-] ComingSoon.php
[edit]
[-] ClassicTemplate.php
[edit]
[+]
Accordion
[-] FeaturedProduct.php
[edit]
[-] ProductSKU.php
[edit]
[-] PaymentMethodIcons.php
[edit]
[-] PriceFilter.php
[edit]
[-] CheckoutAdditionalInformationBlock.php
[edit]
[-] CheckoutContactInformationBlock.php
[edit]
[-] CartOrderSummaryHeadingBlock.php
[edit]
[-] FilledMiniCartContentsBlock.php
[edit]
[-] ProductCategory.php
[edit]
[-] CartLineItemsBlock.php
[edit]
[-] ProductResultsCount.php
[edit]
[-] ReviewsByProduct.php
[edit]
[+]
ProductCollection
[-] AtomicBlock.php
[edit]
[-] ActiveFilters.php
[edit]
[-] CheckoutOrderSummaryCouponFormBlock.php
[edit]
[-] EnableBlockJsonAssetsTrait.php
[edit]
[-] CartOrderSummaryTotalsBlock.php
[edit]
[-] CheckoutTermsBlock.php
[edit]
[-] ProductOnSale.php
[edit]
[-] PageContentWrapper.php
[edit]
[-] CartOrderSummarySubtotalBlock.php
[edit]
[-] ProductSaleBadge.php
[edit]
[-] CategoryTitle.php
[edit]
[-] ProductGalleryLargeImage.php
[edit]
[-] ProductTemplate.php
[edit]
[-] ProductFilterCheckboxList.php
[edit]
[-] MiniCartCheckoutButtonBlock.php
[edit]
[-] ProductsByAttribute.php
[edit]
[-] EmailContent.php
[edit]
[-] ProductQuery.php
[edit]
[-] CheckoutShippingMethodBlock.php
[edit]
[-] ProductFilterAttribute.php
[edit]
[-] ProductDescription.php
[edit]
[-] CheckoutOrderSummaryDiscountBlock.php
[edit]
[-] MiniCartContents.php
[edit]
[-] ProductFilterTaxonomy.php
[edit]
[-] CheckoutOrderSummarySubtotalBlock.php
[edit]
[-] CheckoutOrderSummaryTaxesBlock.php
[edit]
[-] CartOrderSummaryCouponFormBlock.php
[edit]
[-] FeaturedItem.php
[edit]
[-] CartLink.php
[edit]
[-] CustomerAccount.php
[edit]
[-] SingleProduct.php
[edit]
[-] FeaturedCategory.php
[edit]
[-] FilterWrapper.php
[edit]
[-] EmptyCartBlock.php
[edit]
[-] ProductFilterChips.php
[edit]
[-] ProductImageGallery.php
[edit]
[-] ProductTopRated.php
[edit]
[+]
Reviews
[-] CartOrderSummaryShippingBlock.php
[edit]
[+]
AddToCartWithOptions
[-] ProductAverageRating.php
[edit]
[-] CheckoutShippingAddressBlock.php
[edit]
[-] ProductFilterActive.php
[edit]
[-] ProductPrice.php
[edit]
[-] ProductStockIndicator.php
[edit]
[-] CheckoutTotalsBlock.php
[edit]
[-] MiniCartCartButtonBlock.php
[edit]
[-] CheckoutPickupOptionsBlock.php
[edit]
[-] CartAcceptedPaymentMethodsBlock.php
[edit]
[-] ProductSpecifications.php
[edit]
[-] CheckoutOrderNoteBlock.php
[edit]
[-] ProductFilterPrice.php
[edit]
[-] ProductButton.php
[edit]
[-] MiniCart.php
[edit]
[-] HandpickedProducts.php
[edit]
[-] AttributeFilter.php
[edit]
[-] ProductMeta.php
[edit]
[-] MiniCartShoppingButtonBlock.php
[edit]
[-] ProductImage.php
[edit]
[+]
OrderConfirmation
[-] CheckoutOrderSummaryFeeBlock.php
[edit]
[-] MiniCartItemsBlock.php
[edit]
[-] RatingFilter.php
[edit]
[-] StockFilter.php
[edit]
[-] ProductRating.php
[edit]
[-] MiniCartTitleItemsCounterBlock.php
[edit]
[-] CheckoutFieldsBlock.php
[edit]
[-] StoreNotices.php
[edit]
[-] Checkout.php
[edit]
[-] CartOrderSummaryBlock.php
[edit]
[-] MiniCartTitleBlock.php
[edit]
[-] MiniCartProductsTableBlock.php
[edit]
[-] ProductFilterStatus.php
[edit]
[-] ProductDetails.php
[edit]
[-] CartTotalsBlock.php
[edit]
[-] CartCrossSellsProductsBlock.php
[edit]
[-] EmptyMiniCartContentsBlock.php
[edit]
[-] ProductSearch.php
[edit]
[-] CheckoutOrderSummaryTotalsBlock.php
[edit]
[-] ProductBestSellers.php
[edit]
[-] AddToCartForm.php
[edit]
[-] ProductFilterPriceSlider.php
[edit]
[-] Cart.php
[edit]
[-] RelatedProducts.php
[edit]
[-] ClassicShortcode.php
[edit]
[-] ProductFilterRating.php
[edit]
[-] AbstractDynamicBlock.php
[edit]
[-] ProductTitle.php
[edit]
[-] CheckoutShippingMethodsBlock.php
[edit]
[-] CheckoutOrderSummaryShippingBlock.php
[edit]
[-] CheckoutOrderSummaryCartItemsBlock.php
[edit]
[-] CheckoutPaymentBlock.php
[edit]
[-] ProductRatingStars.php
[edit]
[-] ProductGallery.php
[edit]
[-] NextPreviousButtons.php
[edit]
[-] ProductFilters.php
[edit]
[-] ProductRatingCounter.php
[edit]
[-] ProductCategories.php
[edit]
[-] FilledCartBlock.php
[edit]
[-] CategoryDescription.php
[edit]
[-] CatalogSorting.php
[edit]
[-] AbstractInnerBlock.php
[edit]
[-] Breadcrumbs.php
[edit]
[-] ProductNew.php
[edit]
[-] MiniCartFooterBlock.php
[edit]
[-] ProductFilterRemovableChips.php
[edit]
[-] CartOrderSummaryDiscountBlock.php
[edit]
[-] ProceedToCheckoutBlock.php
[edit]
[-] AllProducts.php
[edit]