Skip to content

Commit

Permalink
Blocks: initialize connection assets in Story block.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeymitr committed Oct 22, 2024
1 parent 55c0319 commit 9f77572
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Blocks: initialize connection assets in Story block.
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/extensions/blocks/story/story.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Automattic\Jetpack\Extensions\Story;

use Automattic\Jetpack\Blocks;
use Automattic\Jetpack\Connection\Connection_Assets;
use Jetpack;
use Jetpack_Gutenberg;
use Jetpack_PostImages;
Expand Down Expand Up @@ -442,6 +443,10 @@ function render_block( $attributes ) {
// Let's use a counter to have a different id for each story rendered in the same context.
static $story_block_counter = 0;

if ( 0 === $story_block_counter ) {
Connection_Assets::register_assets();
}

Jetpack_Gutenberg::load_assets_as_required( __DIR__ );

$media_files = isset( $attributes['mediaFiles'] ) ? enrich_media_files( $attributes['mediaFiles'] ) : array();
Expand Down

0 comments on commit 9f77572

Please sign in to comment.