Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions includes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,27 @@
wp_enqueue_script( $script_handle, $src, $deps, $ver, $in_footer );
}

/**
* Register a new script module.
*
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.40.1
*
* @param string $script_handle Name of the script module. Should be unique.
* @param string $src Full URL of the script module.
*/
public function enqueue_script_module( string $script_handle, string $src ): void {
$asset = $this->get_asset_metadata( $script_handle );

Check warning on line 382 in includes/Assets.php

View check run for this annotation

Codecov / codecov/patch

includes/Assets.php#L381-L382

Added lines #L381 - L382 were not covered by tests

wp_enqueue_script_module(
$script_handle,
$src,
$asset['dependencies'], // @phpstan-ignore argument.type
$asset['version'],
);

Check warning on line 389 in includes/Assets.php

View check run for this annotation

Codecov / codecov/patch

includes/Assets.php#L384-L389

Added lines #L384 - L389 were not covered by tests
}

/**
* Remove admin styles.
*
Expand Down
5 changes: 5 additions & 0 deletions includes/Renderer/Stories/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@
$this->assets->enqueue_style_asset( self::STYLE_HANDLE );
}

wp_enqueue_script_module(
'web-stories-embed-view',
$this->assets->get_base_url( 'assets/js/web-stories-block-view.js' )
);

Check warning on line 361 in includes/Renderer/Stories/Renderer.php

View check run for this annotation

Codecov / codecov/patch

includes/Renderer/Stories/Renderer.php#L358-L361

Added lines #L358 - L361 were not covered by tests

if ( $this->context->is_amp() ) {
?>
<div
Expand Down
5 changes: 5 additions & 0 deletions includes/Renderer/Story/Singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
$this->assets->enqueue_script( AMP_Story_Player_Assets::SCRIPT_HANDLE );
$this->assets->enqueue_style_asset( Embed_Base::SCRIPT_HANDLE );

wp_enqueue_script_module(
'web-stories-embed-view',
$this->assets->get_base_url( 'assets/js/web-stories-block-view.js' )
);

Check warning on line 124 in includes/Renderer/Story/Singleton.php

View check run for this annotation

Codecov / codecov/patch

includes/Renderer/Story/Singleton.php#L121-L124

Added lines #L121 - L124 were not covered by tests

ob_start();
?>
<div
Expand Down
Loading