attributes appended on render. * * @since 5.9.0 * * @param array $allowed_namespaces List of namespaces. */ $allowed_blocks = (array) apply_filters( '__experimental_woocommerce_blocks_add_data_attributes_to_block', array() ); if ( ! in_array( $block_namespace, $allowed_namespaces, true ) && ! in_array( $block_name, $allowed_blocks, true ) ) { return $content; } $attributes = (array) $block['attrs']; $exclude_attributes = array( 'className', 'align' ); $escaped_data_attributes = array( 'data-block-name="' . esc_attr( $block['blockName'] ) . '"', ); foreach ( $attributes as $key => $value ) { if ( in_array( $key, $exclude_attributes, true ) ) { continue; } if ( is_bool( $value ) ) { $value = $value ? 'true' : 'false'; } if ( ! is_scalar( $value ) ) { $value = wp_json_encode( $value ); } $escaped_data_attributes[] = 'data-' . esc_attr( strtolower( preg_replace( '/(?'; // phpcs:ignore WordPress.Security.NonceVerification } /** * Hide legacy widgets with a feature complete block equivalent in the inserter * and prevent them from showing as an option in the Legacy Widget block. * * @param array $widget_types An array of widgets hidden in core. * @return array $widget_types An array inluding the WooCommerce widgets to hide. */ public function hide_legacy_widgets_with_block_equivalent( $widget_types ) { array_push( $widget_types, 'woocommerce_product_search', 'woocommerce_product_categories', 'woocommerce_recent_reviews', 'woocommerce_product_tag_cloud', 'woocommerce_price_filter', 'woocommerce_layered_nav', 'woocommerce_layered_nav_filters', 'woocommerce_rating_filter' ); return $widget_types; } /** * Delete product transients when a product is deleted. */ public function delete_product_transients() { delete_transient( 'wc_blocks_has_downloadable_product' ); } /** * Get list of block types. * * @return array */ protected function get_block_types() { global $pagenow; $block_types = array( 'ActiveFilters', 'AddToCartForm', 'AllProducts', 'AllReviews', 'AttributeFilter', 'Breadcrumbs', 'CatalogSorting', 'ClassicTemplate', 'ClassicShortcode', 'ComingSoon', 'CustomerAccount', 'FeaturedCategory', 'FeaturedProduct', 'FilterWrapper', 'HandpickedProducts', 'MiniCart', 'StoreNotices', 'PriceFilter', 'ProductBestSellers', 'ProductButton', 'ProductCategories', 'ProductCategory', 'ProductCollection', 'ProductCollectionNoResults', 'ProductGallery', 'ProductGalleryLargeImage', 'ProductGalleryLargeImageNextPrevious', 'ProductGalleryPager', 'ProductGalleryThumbnails', 'ProductImage', 'ProductImageGallery', 'ProductNew', 'ProductOnSale', 'ProductPrice', 'ProductTemplate', 'ProductQuery', 'ProductAverageRating', 'ProductRating', 'ProductRatingCounter', 'ProductRatingStars', 'ProductResultsCount', 'ProductReviews', 'ProductSaleBadge', 'ProductSearch', 'ProductSKU', 'ProductStockIndicator', 'ProductSummary', 'ProductTag', 'ProductTitle', 'ProductTopRated', 'ProductsByAttribute', 'RatingFilter', 'ReviewsByCategory', 'ReviewsByProduct', 'RelatedProducts', 'ProductDetails', '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', ); $block_types = array_merge( $block_types, Cart::get_cart_block_types(), Checkout::get_checkout_block_types(), MiniCartContents::get_mini_cart_block_types() ); if ( Package::feature()->is_experimental_build() ) { $block_types[] = 'ProductFilter'; $block_types[] = 'ProductFilters'; $block_types[] = 'ProductFilterStockStatus'; $block_types[] = 'ProductFilterPrice'; $block_types[] = 'ProductFilterAttribute'; $block_types[] = 'ProductFilterRating'; $block_types[] = 'ProductFilterActive'; $block_types[] = 'ProductFilterClearButton'; } /** * This disables specific blocks in Widget Areas by not registering them. */ 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_diff( $block_types, array( 'AllProducts', 'Cart', 'Checkout', ) ); } /** * 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( 'AddToCartForm', 'Breadcrumbs', 'CatalogSorting', 'ClassicTemplate', 'ProductResultsCount', 'ProductDetails', '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 ); } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypesController" not found in /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php:248 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\Blocks\Domain\Bootstrap->Automattic\WooCommerce\Blocks\Domain\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #1 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/SharedType.php(28): Automattic\WooCommerce\Blocks\Registry\AbstractDependencyType->resolve_value(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #2 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #3 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php(149): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #4 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php(80): Automattic\WooCommerce\Blocks\Domain\Bootstrap->init() #5 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Package.php(124): Automattic\WooCommerce\Blocks\Domain\Bootstrap->__construct(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #6 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\Blocks\Package::Automattic\WooCommerce\Blocks\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #7 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/SharedType.php(28): Automattic\WooCommerce\Blocks\Registry\AbstractDependencyType->resolve_value(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #8 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #9 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Package.php(44): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #10 [internal function]: Automattic\WooCommerce\Blocks\Package::init() #11 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(128): call_user_func(Array) #12 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(64): Automattic\WooCommerce\Packages::initialize_packages() #13 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Packages::on_init('') #14 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #15 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #16 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #17 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #18 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #19 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #20 /htdocs/index.php(17): require('/htdocs/wp-blog...') #21 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php on line 248