Skip to content

Commit

Permalink
fix apply patch for using tag processor instead of hardcoded list of …
Browse files Browse the repository at this point in the history
…blocks to moved WP_Navigation_Block_Renderer class
  • Loading branch information
fabiankaegy committed Feb 3, 2024
1 parent 055e7a6 commit 53f452a
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@
*/
class WP_Navigation_Block_Renderer {

/**
* Used to determine whether or not a navigation has submenus.
*/
private static $has_submenus = false;

/**
* Used to determine which blocks are wrapped in an <li>.
*
* @var array
*/
private static $nav_blocks_wrapped_in_list_item = array(
'core/navigation-link',
'core/home-link',
'core/site-title',
'core/site-logo',
'core/navigation-submenu',
);

/**
* Used to determine which blocks need an <li> wrapper.
*
Expand Down Expand Up @@ -161,7 +143,9 @@ private static function get_inner_blocks_html( $attributes, $inner_blocks ) {
$is_list_open = false;

foreach ( $inner_blocks as $inner_block ) {
$is_list_item = in_array( $inner_block->name, static::$nav_blocks_wrapped_in_list_item, true );
$inner_block_markup = static::get_markup_for_inner_block( $inner_block );
$p = new WP_HTML_Tag_Processor( $inner_block_markup );

Check failure on line 147 in packages/block-library/src/navigation/index.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Tabs must be used to indent lines; spaces are not allowed
$is_list_item = $p->next_tag( 'LI' );

Check failure on line 148 in packages/block-library/src/navigation/index.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Tabs must be used to indent lines; spaces are not allowed

if ( $is_list_item && ! $is_list_open ) {
$is_list_open = true;
Expand All @@ -176,7 +160,7 @@ private static function get_inner_blocks_html( $attributes, $inner_blocks ) {
$inner_blocks_html .= '</ul>';
}

$inner_blocks_html .= static::get_markup_for_inner_block( $inner_block );
$inner_blocks_html .= $inner_block_markup;
}

if ( $is_list_open ) {
Expand Down

0 comments on commit 53f452a

Please sign in to comment.