From 5ce014967b6ca7e84dfea1a58ccdf34af54bc6b4 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 13 Sep 2022 02:26:14 -0700 Subject: [PATCH] Block Library: Add filter for inner blocks in the Navigation block (#37998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add filter to $inner_blocks * remove extra line space * Apply suggestions from code review * Update index.php Co-authored-by: Greg Ziółkowski --- packages/block-library/src/navigation/index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index f7f3f299cd875..6a5e874225371 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -502,9 +502,18 @@ function render_block_core_navigation( $attributes, $content, $block ) { } $inner_blocks = new WP_Block_List( $fallback_blocks, $attributes ); - } + /** + * Filter navigation block $inner_blocks. + * Allows modification of a navigation block menu items. + * + * @since 6.1.0 + * + * @param \WP_Block_List $inner_blocks + */ + $inner_blocks = apply_filters( 'block_core_navigation_render_inner_blocks', $inner_blocks ); + $layout_justification = array( 'left' => 'items-justified-left', 'right' => 'items-justified-right',