From 001df40813817d31a80a201c7f94542ddeb719c8 Mon Sep 17 00:00:00 2001 From: Takayuki Miyoshi Date: Sun, 12 May 2024 17:44:41 +0900 Subject: [PATCH] Update block registration process #1422 --- includes/block-editor/block-editor.php | 41 +------------------------- includes/block-editor/block.json | 2 +- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/includes/block-editor/block-editor.php b/includes/block-editor/block-editor.php index 403c369b..05a17940 100644 --- a/includes/block-editor/block-editor.php +++ b/includes/block-editor/block-editor.php @@ -7,46 +7,7 @@ ); function wpcf7_init_block_editor_assets() { - $assets = array(); - - $asset_file = wpcf7_plugin_path( - 'includes/block-editor/index.asset.php' - ); - - if ( file_exists( $asset_file ) ) { - $assets = include( $asset_file ); - } - - $assets = wp_parse_args( $assets, array( - 'dependencies' => array( - 'react', - 'wp-api-fetch', - 'wp-block-editor', - 'wp-blocks', - 'wp-components', - 'wp-element', - 'wp-i18n', - 'wp-url', - ), - 'version' => WPCF7_VERSION, - ) ); - - wp_register_script( - 'contact-form-7-block-editor', - wpcf7_plugin_url( 'includes/block-editor/index.js' ), - $assets['dependencies'], - $assets['version'] - ); - - wp_set_script_translations( - 'contact-form-7-block-editor', - 'contact-form-7' - ); - register_block_type( - wpcf7_plugin_path( 'includes/block-editor' ), - array( - 'editor_script_handles' => 'contact-form-7-block-editor', - ) + wpcf7_plugin_path( 'includes/block-editor' ) ); } diff --git a/includes/block-editor/block.json b/includes/block-editor/block.json index c21ee62b..7779a4cb 100644 --- a/includes/block-editor/block.json +++ b/includes/block-editor/block.json @@ -34,5 +34,5 @@ "default": "form" } }, - "editorScript": "file:./index.js" + "editorScript": [ "file:./index.js", "contact-form-7-block-editor" ] }