Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/Interactivity/directives/wp-html.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Interactivity/woo-directives.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php
require_once __DIR__ . '/directives/wp-html.php';

require_once __DIR__ . '/directives/class-woo-directive-context.php';
require_once __DIR__ . '/directives/class-woo-directive-store.php';
require_once __DIR__ . '/directives/woo-process-directives.php';
Expand Down
31 changes: 29 additions & 2 deletions woocommerce-gutenberg-products-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,33 @@ function woocommerce_blocks_plugin_outdated_notice() {

add_action( 'admin_notices', 'woocommerce_blocks_plugin_outdated_notice' );

// Include the Interactivity API.
require_once __DIR__ . '/src/Interactivity/woo-directives.php';
/**
* Disable the Interactivity API if the required `WP_HTML_Tag_Processor` class
* doesn't exist, regardless of whether it was enabled manually.
*
* @param bool $enabled Current filter value.
* @return bool True if _also_ the `WP_HTML_Tag_Processor` class was found.
*/
function woocommerce_blocks_has_wp_html_tag_processor( $enabled ) {
return $enabled && class_exists( 'WP_HTML_Tag_Processor' );
}
add_filter(
'woocommerce_blocks_enable_interactivity_api',
'woocommerce_blocks_has_wp_html_tag_processor',
999
);

/**
* Load and setup the Interactivity API if enabled.
*/
function woocommerce_blocks_interactivity_setup() {
$is_enabled = apply_filters(
'woocommerce_blocks_enable_interactivity_api',
false
);

if ( $is_enabled ) {
require_once __DIR__ . '/src/Interactivity/woo-directives.php';
}
}
add_action( 'plugins_loaded', 'woocommerce_blocks_interactivity_setup' );