Skip to content

Commit

Permalink
Show the unstableLocation menu items even if there are inner blocks, …
Browse files Browse the repository at this point in the history
…as long as there are items at that location.
  • Loading branch information
scruffian committed Nov 26, 2021
1 parent e13c31f commit c6fc6da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ function render_block_core_navigation( $attributes, $content, $block ) {
$inner_blocks = $block->inner_blocks;

// If `__unstableLocation` is defined and:
// - we have menu items at the defined location
// - we don't have a relationship to a `wp_navigation` Post (via `navigationMenuId`).
// - we don't have any inner blocks (e.g. a block pattern).
// ...then create inner blocks from the classic menu assigned to that location.
if (
array_key_exists( '__unstableLocation', $attributes ) &&
! array_key_exists( 'navigationMenuId', $attributes ) &&
empty( $inner_blocks )
! empty( gutenberg_get_menu_items_at_location( $attributes['__unstableLocation'] ) )
) {
$menu_items = gutenberg_get_menu_items_at_location( $attributes['__unstableLocation'] );
if ( empty( $menu_items ) ) {
Expand Down

0 comments on commit c6fc6da

Please sign in to comment.