# speechkit/7.0.0/src/editor/components/select-voice/class-assets.php

BeyondWords – AI audio for publishers, version 7.0.0. 81 lines.

- Page: https://pluginprobe.com/plugins/speechkit/7.0.0/code/src/editor/components/select-voice/class-assets.php
- Raw: https://pluginprobe.com/plugins/speechkit/7.0.0/raw/src/editor/components/select-voice/class-assets.php
- Modified: 2026-08-12T09:46:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/speechkit/7.0.0/code/src/editor/components/select-voice/class-assets.php#L10-L20`.

```php
<?php
/**
 * BeyondWords Select Voice — asset enqueue.
 *
 * @package BeyondWords\Editor\Components\SelectVoice
 * @since   7.0.0
 */

declare( strict_types = 1 );

namespace BeyondWords\Editor\Components\SelectVoice;

defined( 'ABSPATH' ) || exit;

/**
 * Select Voice asset enqueue.
 *
 * @since 7.0.0
 */
class Assets {

	/**
	 * Register WordPress hooks.
	 */
	public static function init(): void {
		add_action( 'admin_enqueue_scripts', [ self::class, 'admin_enqueue_scripts' ] );
	}

	/**
	 * Enqueue the Select Voice JS on classic-editor post screens.
	 *
	 * @param string $hook Current admin page hook.
	 */
	public static function admin_enqueue_scripts( $hook ): void {
		if ( \BeyondWords\Core\Utils::is_gutenberg_page() ) {
			return;
		}

		if ( 'post.php' !== $hook && 'post-new.php' !== $hook ) {
			return;
		}

		if ( ! in_array( get_post_type(), \BeyondWords\Settings\Utils::get_compatible_post_types(), true ) ) {
			return;
		}

		wp_register_script(
			'beyondwords-metabox--select-voice',
			BEYONDWORDS__PLUGIN_URI . 'src/editor/components/select-voice/classic-metabox.js',
			[],
			BEYONDWORDS__PLUGIN_VERSION,
			true
		);

		wp_localize_script(
			'beyondwords-metabox--select-voice',
			'beyondwordsData',
			[
				'nonce'            => wp_create_nonce( 'wp_rest' ),
				'root'             => esc_url_raw( rest_url() ),
				'projectId'        => (string) get_option( 'beyondwords_project_id', '' ),
				// Lets the script rebuild the Accent dropdown when a language name is picked.
				'languages'        => \BeyondWords\Editor\Components\SelectVoice::languages_for_script(),
				'selectVoice'      => __( 'Select a voice', 'speechkit' ),
				'selectModel'      => __( 'Select a model', 'speechkit' ),
				'standardModel'    => __( 'Legacy', 'speechkit' ),
				'elevenLabs'       => \BeyondWords\Editor\Components\SelectVoice::ELEVENLABS_SERVICE,
				'defaultModelId'   => \BeyondWords\Editor\Components\SelectVoice::DEFAULT_ELEVENLABS_VOICE_MODEL_ID,
				'voiceModelLabels' => [
					'eleven_v3'              => __( 'v3', 'speechkit' ),
					'eleven_multilingual_v2' => __( 'Multilingual v2', 'speechkit' ),
					'eleven_flash_v2_5'      => __( 'Flash v2.5', 'speechkit' ),
					'eleven_turbo_v2_5'      => __( 'Turbo v2.5', 'speechkit' ),
				],
			]
		);

		wp_enqueue_script( 'beyondwords-metabox--select-voice' );
	}
}

```
