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 / components / settings-fields / class-assets.php

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

72 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * BeyondWords Settings Fields — asset enqueue.
4 *
5 * @package BeyondWords\Editor\Components\SettingsFields
6 * @since 7.0.0
7 */
8
9 declare( strict_types = 1 );
10
11 namespace BeyondWords\Editor\Components\SettingsFields;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Settings Fields 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( 'admin_enqueue_scripts', [ self::class, 'admin_enqueue_scripts' ] );
27 }
28
29 /**
30 * Enqueue the Settings Fields JS on classic-editor post screens.
31 *
32 * @param string $hook Current admin page hook.
33 */
34 public static function admin_enqueue_scripts( $hook ): void {
35 if ( \BeyondWords\Core\Utils::is_gutenberg_page() ) {
36 return;
37 }
38
39 if ( 'post.php' !== $hook && 'post-new.php' !== $hook ) {
40 return;
41 }
42
43 if ( ! in_array( get_post_type(), \BeyondWords\Settings\Utils::get_compatible_post_types(), true ) ) {
44 return;
45 }
46
47 wp_register_script(
48 'beyondwords-metabox--settings-fields',
49 BEYONDWORDS__PLUGIN_URI . 'src/editor/components/settings-fields/classic-metabox.js',
50 [],
51 BEYONDWORDS__PLUGIN_VERSION,
52 true
53 );
54
55 wp_localize_script(
56 'beyondwords-metabox--settings-fields',
57 'beyondwordsSettingsFields',
58 [
59 'embedLabels' => [
60 'none' => __( 'None', 'speechkit' ),
61 'audio_post' => __( 'Audio (post)', 'speechkit' ),
62 'audio_script' => __( 'Audio (script)', 'speechkit' ),
63 'video_post' => __( 'Video (post)', 'speechkit' ),
64 'video_script' => __( 'Video (script)', 'speechkit' ),
65 ],
66 ]
67 );
68
69 wp_enqueue_script( 'beyondwords-metabox--settings-fields' );
70 }
71 }
72