Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
use 'enqueue_block_assets' is available
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed May 3, 2023
1 parent 899d80f commit 5aa74cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Assets/AssetDataRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function __construct( Api $asset_api ) {
* Hook into WP asset registration for enqueueing asset data.
*/
protected function init() {
add_action( 'init', array( $this, 'register_data_script' ) );
// @todo: Remove this check when WordPress 6.3 is the minimum supported version.
add_action( has_action( 'enqueue_block_assets' ) ? 'enqueue_block_assets' : 'init', array( $this, 'register_data_script' ) );
add_action( 'wp_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 );
add_action( 'admin_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 );
}
Expand Down

0 comments on commit 5aa74cd

Please sign in to comment.