Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
CRAP | n/a |
0 / 0 |
|
| wpcom_enqueue_block_inserter_modifications_assets | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * WPCOM Block Inserter Modifications |
| 4 | * |
| 5 | * @package automattic/jetpack-mu-wpcom |
| 6 | */ |
| 7 | |
| 8 | use Automattic\Jetpack\Jetpack_Mu_Wpcom; |
| 9 | |
| 10 | /** |
| 11 | * Enqueue script for the Block Inserter modifications. |
| 12 | */ |
| 13 | function wpcom_enqueue_block_inserter_modifications_assets() { |
| 14 | $asset_file = include Jetpack_Mu_Wpcom::BASE_DIR . 'build/block-inserter-modifications/block-inserter-modifications.asset.php'; |
| 15 | |
| 16 | wp_enqueue_script( |
| 17 | 'block-inserter-modifications-script', |
| 18 | plugins_url( 'build/block-inserter-modifications/block-inserter-modifications.js', Jetpack_Mu_Wpcom::BASE_FILE ), |
| 19 | $asset_file['dependencies'] ?? array(), |
| 20 | $asset_file['version'] ?? filemtime( Jetpack_Mu_Wpcom::BASE_DIR . 'build/block-inserter-modifications/block-inserter-modifications.js' ), |
| 21 | true |
| 22 | ); |
| 23 | |
| 24 | wp_set_script_translations( 'block-inserter-modifications-script', 'jetpack-mu-wpcom' ); |
| 25 | |
| 26 | $style_name = 'block-inserter-modifications'; |
| 27 | $style_file = is_rtl() ? $style_name . '.rtl.css' : $style_name . '.css'; |
| 28 | |
| 29 | wp_enqueue_style( |
| 30 | 'block-inserter-modifications-styles', |
| 31 | plugins_url( 'build/block-inserter-modifications/' . $style_file, Jetpack_Mu_Wpcom::BASE_FILE ), |
| 32 | array(), |
| 33 | filemtime( Jetpack_Mu_Wpcom::BASE_DIR . 'build/block-inserter-modifications/' . $style_file ) |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | add_action( 'enqueue_block_editor_assets', 'wpcom_enqueue_block_inserter_modifications_assets', 0 ); |