Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Assets | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| init | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| admin_enqueue_scripts | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * BeyondWords Inspect Panel — asset enqueue. |
| 4 | * |
| 5 | * @package BeyondWords\Editor\Components\InspectPanel |
| 6 | * @since 7.0.0 |
| 7 | */ |
| 8 | |
| 9 | declare( strict_types = 1 ); |
| 10 | |
| 11 | namespace BeyondWords\Editor\Components\InspectPanel; |
| 12 | |
| 13 | defined( 'ABSPATH' ) || exit; |
| 14 | |
| 15 | /** |
| 16 | * Inspect panel 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 Inspect 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 ( 'post.php' !== $hook && 'post-new.php' !== $hook ) { |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | wp_enqueue_script( |
| 40 | 'beyondwords-inspect', |
| 41 | BEYONDWORDS__PLUGIN_URI . 'src/editor/components/inspect-panel/js/inspect.js', |
| 42 | [ 'wp-i18n' ], |
| 43 | BEYONDWORDS__PLUGIN_VERSION, |
| 44 | true |
| 45 | ); |
| 46 | } |
| 47 | } |