Automattic\WooCommerce\Blocks
BlockTypesController::get_block_types │ protected │ WC 1.0
Get list of block types.
Method of the class: BlockTypesController{}
Hooks from the method
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_block_types();
BlockTypesController::get_block_types() BlockTypesController::get block types code WC 10.3.3
protected function get_block_types() {
global $pagenow;
$block_types = array(
'ActiveFilters',
'AddToCartForm',
'AllProducts',
'AllReviews',
'AttributeFilter',
'Breadcrumbs',
'CartLink',
'CatalogSorting',
'ClassicTemplate',
'ClassicShortcode',
'ComingSoon',
'CustomerAccount',
'EmailContent',
'FeaturedCategory',
'FeaturedProduct',
'FilterWrapper',
'HandpickedProducts',
'MiniCart',
'NextPreviousButtons',
'StoreNotices',
'PaymentMethodIcons',
'PriceFilter',
'ProductBestSellers',
'ProductButton',
'ProductCategories',
'ProductCategory',
'ProductCollection\Controller',
'ProductCollection\NoResults',
'ProductFilters',
'ProductFilterStatus',
'ProductFilterPrice',
'ProductFilterPriceSlider',
'ProductFilterAttribute',
'ProductFilterRating',
'ProductFilterActive',
'ProductFilterRemovableChips',
'ProductFilterClearButton',
'ProductFilterCheckboxList',
'ProductFilterChips',
'ProductFilterTaxonomy',
'ProductGallery',
'ProductGalleryLargeImage',
'ProductGalleryThumbnails',
'ProductImage',
'ProductImageGallery',
'ProductMeta',
'ProductNew',
'ProductOnSale',
'ProductPrice',
'ProductTemplate',
'ProductQuery',
'ProductAverageRating',
'ProductRating',
'ProductRatingCounter',
'ProductRatingStars',
'ProductResultsCount',
'ProductSaleBadge',
'ProductSearch',
'ProductSKU',
'ProductStockIndicator',
'ProductSummary',
'ProductTag',
'ProductTitle',
'ProductTopRated',
'ProductsByAttribute',
'RatingFilter',
'ReviewsByCategory',
'ReviewsByProduct',
'RelatedProducts',
'SingleProduct',
'StockFilter',
'PageContentWrapper',
'OrderConfirmation\Status',
'OrderConfirmation\Summary',
'OrderConfirmation\Totals',
'OrderConfirmation\TotalsWrapper',
'OrderConfirmation\Downloads',
'OrderConfirmation\DownloadsWrapper',
'OrderConfirmation\BillingAddress',
'OrderConfirmation\ShippingAddress',
'OrderConfirmation\BillingWrapper',
'OrderConfirmation\ShippingWrapper',
'OrderConfirmation\AdditionalInformation',
'OrderConfirmation\AdditionalFieldsWrapper',
'OrderConfirmation\AdditionalFields',
'OrderConfirmation\CreateAccount',
'ProductDetails',
'ProductDescription',
'ProductSpecifications',
// Generic blocks that will be pushed upstream.
'Accordion\AccordionGroup',
'Accordion\AccordionItem',
'Accordion\AccordionPanel',
'Accordion\AccordionHeader',
// End: generic blocks that will be pushed upstream.
'Reviews\ProductReviews',
'Reviews\ProductReviewRating',
'Reviews\ProductReviewsTitle',
'Reviews\ProductReviewForm',
'Reviews\ProductReviewDate',
'Reviews\ProductReviewContent',
'Reviews\ProductReviewAuthorName',
'Reviews\ProductReviewsPagination',
'Reviews\ProductReviewsPaginationNext',
'Reviews\ProductReviewsPaginationPrevious',
'Reviews\ProductReviewsPaginationNumbers',
'Reviews\ProductReviewTemplate',
);
$block_types = array_merge(
$block_types,
Cart::get_cart_block_types(),
Checkout::get_checkout_block_types(),
MiniCartContents::get_mini_cart_block_types()
);
if ( wp_is_block_theme() ) {
$block_types[] = 'AddToCartWithOptions\AddToCartWithOptions';
$block_types[] = 'AddToCartWithOptions\QuantitySelector';
$block_types[] = 'AddToCartWithOptions\VariationDescription';
$block_types[] = 'AddToCartWithOptions\VariationSelector';
$block_types[] = 'AddToCartWithOptions\VariationSelectorAttribute';
$block_types[] = 'AddToCartWithOptions\VariationSelectorAttributeName';
$block_types[] = 'AddToCartWithOptions\VariationSelectorAttributeOptions';
$block_types[] = 'AddToCartWithOptions\GroupedProductSelector';
$block_types[] = 'AddToCartWithOptions\GroupedProductItem';
$block_types[] = 'AddToCartWithOptions\GroupedProductItemSelector';
$block_types[] = 'AddToCartWithOptions\GroupedProductItemLabel';
}
/**
* This enables specific blocks in Widget Areas using an opt-in approach.
*/
if ( in_array( $pagenow, array( 'widgets.php', 'themes.php', 'customize.php' ), true ) && ( empty( $_GET['page'] ) || 'gutenberg-edit-site' !== $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
$block_types = array_intersect(
$block_types,
$this->get_widget_area_block_types()
);
}
/**
* This disables specific blocks in Post and Page editor by not registering them.
*/
if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
$block_types = array_diff(
$block_types,
array(
'Breadcrumbs',
'CatalogSorting',
'ClassicTemplate',
'ProductResultsCount',
'ProductReviews',
'OrderConfirmation\Status',
'OrderConfirmation\Summary',
'OrderConfirmation\Totals',
'OrderConfirmation\TotalsWrapper',
'OrderConfirmation\Downloads',
'OrderConfirmation\DownloadsWrapper',
'OrderConfirmation\BillingAddress',
'OrderConfirmation\ShippingAddress',
'OrderConfirmation\BillingWrapper',
'OrderConfirmation\ShippingWrapper',
'OrderConfirmation\AdditionalInformation',
'OrderConfirmation\AdditionalFieldsWrapper',
'OrderConfirmation\AdditionalFields',
)
);
}
/**
* Filters the list of allowed block types.
*
* @since 9.0.0
*
* @param array $block_types List of block types.
*/
return apply_filters( 'woocommerce_get_block_types', $block_types );
}