PluginProbe
BeyondWords – AI audio for publishers / 7.0.0
BeyondWords – AI audio for publishers v7.0.0
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / editor / block / class-assets.php

class-assets.php in BeyondWords – AI audio for publishers 7.0.0, at src/editor/block/class-assets.php

51 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * BeyondWords block-editor asset enqueue.
4 *
5 * @package BeyondWords\Editor\Block
6 * @since 7.0.0
7 */
8
9 declare( strict_types = 1 );
10
11 namespace BeyondWords\Editor\Block;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Block-editor asset enqueue.
17 *
18 * @since 7.0.0
19 */
20 class Assets {
21
22 /**
23 * Register WordPress hooks.
24 */
25 public static function init(): void {
26 add_action( 'enqueue_block_editor_assets', [ self::class, 'enqueue_block_editor_assets' ], 1, 0 );
27 }
28
29 /**
30 * Enqueue the bundled block-editor JS on compatible post-type screens.
31 *
32 * No API-valid check needed: class-plugin.php only calls init() with a
33 * valid API connection.
34 */
35 public static function enqueue_block_editor_assets(): void {
36 if ( ! in_array( get_post_type(), \BeyondWords\Settings\Utils::get_compatible_post_types(), true ) ) {
37 return;
38 }
39
40 $asset_file = include BEYONDWORDS__PLUGIN_DIR . 'build/index.asset.php';
41
42 wp_enqueue_script(
43 'beyondwords-block-js',
44 BEYONDWORDS__PLUGIN_URI . 'build/index.js',
45 $asset_file['dependencies'],
46 $asset_file['version'],
47 true
48 );
49 }
50 }
51