Changeset 13873 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/blocks.php
- Timestamp:
- 07/03/2024 10:55:23 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/blocks.php
r13754 r13873 26 26 add_action( 'init', __NAMESPACE__ . '\register_types' ); 27 27 add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_style_assets' ); 28 add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_course_grid_assets' );29 28 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_block_style_assets' ); 30 29 … … 451 450 452 451 /** 453 * Enqueue course grid assets.454 *455 * @throws Error If the build files are not found.456 */457 function enqueue_course_grid_assets() {458 $script_asset_path = get_build_path() . 'course-grid.asset.php';459 if ( ! is_readable( $script_asset_path ) ) {460 throw new Error(461 'You need to run `npm start` or `npm run build` for the "wporg-learn/course-grid" block first.'462 );463 }464 465 $script_asset = require $script_asset_path;466 wp_enqueue_script(467 'wporg-learn-course-grid',468 get_build_url() . 'course-grid.js',469 $script_asset['dependencies'],470 $script_asset['version'],471 true472 );473 }474 475 /**476 452 * Register the learning duration block. 477 453 */
Note: See TracChangeset
for help on using the changeset viewer.