Skip to content

Commit

Permalink
Enqueue modal script when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jan 31, 2022
1 parent e465733 commit 107b772
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
wp_enqueue_script( 'wp-block-navigation-view' );
}

$should_load_modal_view_script = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'];
if ( $should_load_modal_view_script ) {
wp_enqueue_script( 'wp-block-navigation-view-modal' );
}

$inner_blocks = $block->inner_blocks;

// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
Expand Down

0 comments on commit 107b772

Please sign in to comment.