base === 'appearance_page_gutenberg-edit-site' || $screen->base === 'site-editor'; $hook_name = $site_editor ? 'admin_enqueue_scripts' : 'enqueue_block_editor_assets'; add_action( $hook_name, fn() => do_action( 'blockify_editor_scripts' ) ); } add_action( 'blockify_editor_scripts', NS . 'enqueue_editor_scripts' ); /** * Enqueues editor assets. * * @since 0.0.14 * * @return void */ function enqueue_editor_scripts(): void { $asset = require DIR . 'assets/js/editor.asset.php'; $deps = $asset['dependencies']; wp_register_script( 'blockify-editor', get_url() . 'assets/js/editor.js', $deps, filemtime( DIR . 'assets/js/editor.js' ), true ); wp_enqueue_script( 'blockify-editor' ); wp_localize_script( 'blockify-editor', SLUG, array_merge_recursive( [ 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( SLUG ), 'icon' => trim( file_get_contents( DIR . 'assets/svg/social/blockify.svg' ) ), 'darkMode' => ( get_option( SLUG )['darkMode'] ?? false ) === 'true', 'removeEmojiScripts' => ( get_option( SLUG )['removeEmojiScripts'] ?? null ) === 'true', 'excerptLength' => get_option( SLUG )['excerptLength'] ?? 33, ], get_config() ) ); }