Fix asset importing

This commit is contained in:
Michael Thomas 2022-02-14 16:54:46 -05:00
parent b142f57648
commit ff1f452e61
1 changed files with 15 additions and 16 deletions

View File

@ -79,16 +79,14 @@ if ( !class_exists('CognitoFormsPlugin') ) {
// Initialize block // Initialize block
public function block_init() { public function block_init() {
$dir = dirname( __FILE__ );
$asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/index.asset.php'); $asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/index.asset.php');
// Register global block styles // Register global block styles
wp_register_style( wp_register_style(
'cognito-block-global-css', // Handle. 'cognito-block-global-css', // Handle.
plugins_url( 'dist/style.css', __FILE__ ), plugins_url( 'dist/style-main.css', __FILE__ ), // Public CSS
is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it. is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time. $asset_file['version']
); );
// Register block editor script for backend // Register block editor script for backend
@ -104,7 +102,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
'cognito-block-editor-css', // Handle. 'cognito-block-editor-css', // Handle.
plugins_url( 'dist/main.css', __FILE__ ), // Block editor CSS. plugins_url( 'dist/main.css', __FILE__ ), // Block editor CSS.
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it. array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time. $asset_file['version']
); );
register_block_type( register_block_type(
@ -115,7 +113,8 @@ if ( !class_exists('CognitoFormsPlugin') ) {
'editor_script' => 'cognito-block-editor-js', 'editor_script' => 'cognito-block-editor-js',
// Enqueue editor block styles in the editor only // Enqueue editor block styles in the editor only
'editor_style' => 'cognito-block-editor-css' 'editor_style' => 'cognito-block-editor-css'
) ); )
);
} }
// Initialize classic editor (TinyMCE) // Initialize classic editor (TinyMCE)