Skip to content

Commit

Permalink
Allow block attributes passed to block renderer by way of wp_nav_menu. (
Browse files Browse the repository at this point in the history
  • Loading branch information
pbking authored May 24, 2021
1 parent 6a09db4 commit c9b638d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,14 @@ function gutenberg_output_block_nav_menu( $output, $args ) {
$menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
}

$block_attributes = array();
if ( isset( $args->block_attributes ) ) {
$block_attributes = $args->block_attributes;
}

$navigation_block = array(
'blockName' => 'core/navigation',
'attrs' => array(),
'attrs' => $block_attributes,
'innerBlocks' => gutenberg_convert_menu_items_to_blocks(
isset( $menu_items_by_parent_id[0] )
? $menu_items_by_parent_id[0]
Expand Down

0 comments on commit c9b638d

Please sign in to comment.