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

@ -17,13 +17,13 @@
*/
/**
* Plugin Name: Cognito Forms
* Plugin URI: http://wordpress.org/plugins/cognito-forms/
* Description: Cognito Forms is a free online form builder that integrates seamlessly with WordPress. Create contact forms, registrations forms, surveys, and more!
* Version: 2.0.0
* Author: Cognito Apps
* Author URI: https://www.cognitoforms.com
* License: GPL v2 or later
* Plugin Name: Cognito Forms
* Plugin URI: http://wordpress.org/plugins/cognito-forms/
* Description: Cognito Forms is a free online form builder that integrates seamlessly with WordPress. Create contact forms, registrations forms, surveys, and more!
* Version: 2.0.0
* Author: Cognito Apps
* Author URI: https://www.cognitoforms.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
@ -49,7 +49,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
private function addActions($actions) {
foreach($actions as $action)
add_action($action, array($this, $action));
}
}
// Registers plug-in filters
private function addFilters($filters) {
@ -79,16 +79,14 @@ if ( !class_exists('CognitoFormsPlugin') ) {
// Initialize block
public function block_init() {
$dir = dirname( __FILE__ );
$asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/index.asset.php');
// Register global block styles
wp_register_style(
'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.
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
$asset_file['version']
);
// Register block editor script for backend
@ -104,7 +102,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
'cognito-block-editor-css', // Handle.
plugins_url( 'dist/main.css', __FILE__ ), // Block editor CSS.
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(
@ -115,16 +113,17 @@ if ( !class_exists('CognitoFormsPlugin') ) {
'editor_script' => 'cognito-block-editor-js',
// Enqueue editor block styles in the editor only
'editor_style' => 'cognito-block-editor-css'
) );
)
);
}
// Initialize classic editor (TinyMCE)
public function tinymce_init() {
if(get_user_option('rich_editing') == 'true') {
$this->addFilters(array(
$this->addFilters( array(
'mce_buttons',
'mce_external_plugins'
));
) );
}
}