wp-includes/blocks/navigation.php:87Helper functions used to render the navigation block.
Every hook that fires from inside WP_Navigation_Block_Renderer, in the order it appears in the class, grouped by the method that fires it.
$needs_list_item_wrapperarrayprivate staticclass WP_Navigation_Block_Renderer { /** * Used to determine whether or not a navigation has submenus. * * @since 6.5.0 */ private static $has_submenus = false; /** * Used to determine which blocks need an <li> wrapper. * * @since 6.5.0 * * @var array */ private static $needs_list_item_wrapper = array( 'core/site-title', 'core/site-logo', 'core/social-links', ); /** * Keeps track of all the navigation names that have been seen. * * @since 6.5.0 * * @var array */ private static $seen_menu_names = array(); /** * Returns whether or not this is responsive navigation. * * @since 6.5.0 * * @param array $attributes The block attributes. * @return bool Returns whether or not this is responsive navigation. */ private static function is_responsive( $attributes ) { /** * This is for backwards compatibility after the `isResponsive` attribute was been removed. */ $has_old_responsive_attribute = ! empty( $attributes['isResponsive'] ) && $attributes['isResponsive']; return isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'] || $has_old_responsive_attribute; } /** * Returns whether or not a navigation has a submenu. * * @since 6.5.0 * * @param WP_Block_List $inner_blocks The list of inner blocks. * @return bool Returns whether or not a navigation has a submenu and also sets the member variable. */ private static function has_submenus( $inner_blocks ) { if ( true === static::$has_submenus ) { return static::$has_submenus; } foreach ( $inner_blocks as $inner_block ) { // If this is a page list then work out if any of the pages have children. if ( 'core/page-list' === $inner_block->name ) { $all_pages = get_pages( array( 'sort_column' => 'menu_order,post_title', 'order' => 'asc', ) ); foreach ( (array) $all_pages as $page ) { if ( $page->post_parent ) { static::$has_submenus = true; break; } } } // If this is a navigation submenu then we know we have submenus. if ( 'core/navigation-submenu' === $inner_block->name ) {Introduced in 6.5.0. 9 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
get_template_part_blocks_html() added.verified against sourcedisable_overlay_menu_for_nested_navigation_blocks() added.verified against sourceget_overlay_blocks_from_template_part() added.verified against sourceget_responsive_container_classes() added.verified against sourceget_overlay_inline_styles() added.verified against sourceget_nav_attributes() added.verified against sourceget_inner_block_markup() added.verified against sourceget_nav_wrapper_attributes() removed.verified against sourceget_wrapper_markup() removed.verified against sourcesrc/wp-includes/blocks/navigation.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.