PluginProbe
Gutenberg / 22.3.0
Gutenberg v22.3.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / modules.php

modules.php in Gutenberg 22.3.0, at build/modules.php

45 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Script module registration - Auto-generated by build process.
4 * Do not edit this file manually.
5 *
6 * @package gutenberg
7 */
8
9 if ( ! function_exists( 'gutenberg_register_script_modules' ) ) {
10 /**
11 * Register all script modules.
12 */
13 function gutenberg_register_script_modules() {
14 $modules_dir = __DIR__ . '/modules';
15 $modules_file = $modules_dir . '/index.php';
16
17 if ( ! file_exists( $modules_file ) ) {
18 return;
19 }
20
21 $modules = require $modules_file;
22 $base_url = plugins_url( 'build/modules/', dirname( __FILE__ ) );
23 $extension = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
24
25 foreach ( $modules as $module ) {
26 $asset_path = $modules_dir . '/' . $module['asset'];
27 $asset = file_exists( $asset_path ) ? require $asset_path : array();
28
29 wp_register_script_module(
30 $module['id'],
31 $base_url . $module['path'] . $extension,
32 $asset['module_dependencies'] ?? array(),
33 $asset['version'] ?? false,
34 array(
35 'fetchpriority' => 'low',
36 'in_footer' => true,
37 )
38 );
39 }
40 }
41
42 add_action( 'wp_default_scripts', 'gutenberg_register_script_modules' );
43 remove_action( 'wp_default_scripts', 'wp_default_script_modules' );
44 }
45