| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Server-side rendering of the `core/navigation` block.
| File Size: | 2019 lines (72 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
WP_Navigation_Block_Renderer:: (49 methods):
is_responsive()
has_submenus()
is_interactive()
does_block_need_a_list_item_wrapper()
get_markup_for_inner_block()
get_template_part_blocks_html()
get_inner_blocks_html()
get_inner_blocks_from_navigation_post()
get_inner_blocks_from_fallback()
disable_overlay_menu_for_nested_navigation_blocks()
get_overlay_blocks_from_template_part()
get_inner_blocks()
get_navigation_name()
get_layout_class()
get_classes()
get_styles()
get_responsive_container_classes()
get_overlay_inline_styles()
get_responsive_container_markup()
get_nav_attributes()
get_nav_element_directives()
handle_view_script_module_loading()
get_inner_block_markup()
get_unique_navigation_name()
render()
block_core_navigation_get_menu_items_at_location()
block_core_navigation_sort_menu_items_by_parent_id()
block_core_navigation_get_inner_blocks_from_unstable_location()
block_core_navigation_overlay_html_has_close_block()
block_core_navigation_add_directives_to_overlay_close()
block_core_navigation_set_overlay_image_fetch_priority()
block_core_navigation_add_directives_to_submenu()
block_core_navigation_build_css_colors()
block_core_navigation_build_css_font_sizes()
block_core_navigation_filter_out_empty_blocks()
block_core_navigation_block_tree_has_block_type()
block_core_navigation_block_contains_core_navigation()
block_core_navigation_get_fallback_blocks()
block_core_navigation_get_post_ids()
block_core_navigation_from_block_get_post_ids()
render_block_core_navigation()
register_block_core_navigation()
block_core_navigation_add_support_classes_to_container()
block_core_navigation_typographic_presets_backcompatibility()
block_core_navigation_parse_blocks_from_menu_items()
block_core_navigation_get_classic_menu_fallback()
block_core_navigation_get_classic_menu_fallback_blocks()
block_core_navigation_maybe_use_classic_menu_fallback()
block_core_navigation_get_most_recently_published_navigation()
Class: WP_Navigation_Block_Renderer - X-Ref
Helper functions used to render the navigation block.| is_responsive( $attributes ) X-Ref |
| Returns whether or not this is responsive navigation. param: array $attributes The block attributes. return: bool Returns whether or not this is responsive navigation. |
| has_submenus( $inner_blocks ) X-Ref |
| Returns whether or not a navigation has a submenu. 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. |
| is_interactive( $attributes, $inner_blocks ) X-Ref |
| Determine whether the navigation blocks is interactive. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. return: bool Returns whether or not to load the view script. |
| does_block_need_a_list_item_wrapper( $block ) X-Ref |
| Returns whether or not a block needs a list item wrapper. param: WP_Block $block The block. return: bool Returns whether or not a block needs a list item wrapper. |
| get_markup_for_inner_block( $inner_block ) X-Ref |
| Returns the markup for a single inner block. param: WP_Block $inner_block The inner block. return: string Returns the markup for a single inner block. |
| get_template_part_blocks_html( $blocks ) X-Ref |
| Returns the html for blocks from a template part (without navigation container wrapper). param: WP_Block_List $blocks The list of blocks to render. return: string Returns the html for the template part blocks. |
| get_inner_blocks_html( $attributes, $inner_blocks ) X-Ref |
| Returns the html for the inner blocks of the navigation block. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. return: string Returns the html for the inner blocks of the navigation block. |
| get_inner_blocks_from_navigation_post( $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from the navigation post. param: array $attributes The block attributes. return: WP_Block_List Returns the inner blocks for the navigation block. |
| get_inner_blocks_from_fallback( $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from the fallback. param: array $attributes The block attributes. return: WP_Block_List Returns the inner blocks for the navigation block. |
| disable_overlay_menu_for_nested_navigation_blocks( $blocks ) X-Ref |
| Recursively disables overlay menu for navigation blocks within overlay blocks. Prevents nested overlays (inception). param: array $blocks Array of parsed block arrays. return: array Modified blocks with overlayMenu set to 'never' for navigation blocks. |
| get_overlay_blocks_from_template_part( $overlay_template_part_id, $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from an overlay template part. param: string $overlay_template_part_id The overlay template part ID in format "theme//slug". param: array $attributes The block attributes. return: WP_Block_List Returns the inner blocks for the overlay template part. |
| get_inner_blocks( $attributes, $block ) X-Ref |
| Gets the inner blocks for the navigation block. param: array $attributes The block attributes. param: WP_Block $block The parsed block. return: WP_Block_List Returns the inner blocks for the navigation block. |
| get_navigation_name( $attributes ) X-Ref |
| Gets the name of the current navigation, if it has one. param: array $attributes The block attributes. return: string Returns the name of the navigation. |
| get_layout_class( $attributes ) X-Ref |
| Returns the layout class for the navigation block. param: array $attributes The block attributes. return: string Returns the layout class for the navigation block. |
| get_classes( $attributes ) X-Ref |
| Return classes for the navigation block. param: array $attributes The block attributes. return: string Returns the classes for the navigation block. |
| get_styles( $attributes ) X-Ref |
| Get styles for the navigation block. param: array $attributes The block attributes. return: string Returns the styles for the navigation block. |
| get_responsive_container_classes( $is_hidden_by_default, $has_custom_overlay, $colors ) X-Ref |
| Get responsive container classes for the navigation block. param: bool $is_hidden_by_default Whether the responsive menu is hidden by default. param: bool $has_custom_overlay Whether a custom overlay is used. param: array $colors The colors array. return: array Returns the responsive container classes. |
| get_overlay_inline_styles( $has_custom_overlay, $colors ) X-Ref |
| Get overlay inline styles for the navigation block. param: bool $has_custom_overlay Whether a custom overlay is used. param: array $colors The colors array. return: string Returns the overlay inline styles. |
| get_responsive_container_markup( $attributes, $inner_blocks, $inner_blocks_html ) X-Ref |
| Get the responsive container markup param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. param: string $inner_blocks_html The markup for the inner blocks. return: string Returns the container markup. |
| get_nav_attributes( $attributes, $inner_blocks ) X-Ref |
| Get the wrapper attributes param: array $attributes The block attributes. param: WP_Block_List $inner_blocks A list of inner blocks. return: string Returns the navigation block markup. |
| get_nav_element_directives( $is_interactive ) X-Ref |
| Gets the nav element directives. param: bool $is_interactive Whether the block is interactive. return: string the directives for the navigation element. |
| handle_view_script_module_loading( $attributes, $block, $inner_blocks ) X-Ref |
| Handle view script module loading. param: array $attributes The block attributes. param: WP_Block $block The parsed block. param: WP_Block_List $inner_blocks The list of inner blocks. |
| get_inner_block_markup( $attributes, $inner_blocks ) X-Ref |
| Returns the markup for the navigation block. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. return: string Returns the navigation wrapper markup. |
| get_unique_navigation_name( $attributes ) X-Ref |
| Returns a unique name for the navigation. param: array $attributes The block attributes. return: string Returns a unique name for the navigation. |
| render( $attributes, $content, $block ) X-Ref |
| Renders the navigation block. param: array $attributes The block attributes. param: string $content The saved content. param: WP_Block $block The parsed block. return: string Returns the navigation block markup. |
| block_core_navigation_get_menu_items_at_location( $location ) X-Ref |
| Returns the menu items for a WordPress menu location. param: string $location The menu location. return: array Menu items for the location. |
| block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) X-Ref |
| Sorts a standard array of menu items into a nested structure keyed by the id of the parent menu. param: array $menu_items Menu items to sort. return: array An array keyed by the id of the parent menu where each element |
| block_core_navigation_get_inner_blocks_from_unstable_location( $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from the unstable location attribute. param: array $attributes The block attributes. return: WP_Block_List Returns the inner blocks for the navigation block. |
| block_core_navigation_overlay_html_has_close_block( $html ) X-Ref |
| Checks if the overlay HTML contains a navigation-overlay-close block. Uses WP_HTML_Tag_Processor to detect the close button in rendered output, so it works when the overlay uses patterns (pattern content is rendered at output time, not in the block tree). param: string $html The rendered overlay HTML. return: bool True if a close button element is found. |
| block_core_navigation_add_directives_to_overlay_close( $tags ) X-Ref |
| Add Interactivity API directives to the navigation-overlay-close block markup using the Tag Processor. param: WP_HTML_Tag_Processor $tags Markup of the navigation block. return: string Overlay close markup with the directives injected. |
| block_core_navigation_set_overlay_image_fetch_priority( string $overlay_blocks_html ) X-Ref |
| Sets fetchpriority="low" on all IMG tags within the navigation overlay. Images in the overlay are hidden until the menu is opened, so they should not compete with any actual LCP element image on the page. param: string $overlay_blocks_html The rendered HTML of the overlay blocks. return: string Modified HTML with fetchpriority="low" on all IMG tags. |
| block_core_navigation_add_directives_to_submenu( $tags, $block_attributes ) X-Ref |
| Add Interactivity API directives to the navigation-submenu and page-list blocks markup using the Tag Processor. param: WP_HTML_Tag_Processor $tags Markup of the navigation block. param: array $block_attributes Block attributes. return: string Submenu markup with the directives injected. |
| block_core_navigation_build_css_colors( $attributes ) X-Ref |
| Build an array with CSS classes and inline styles defining the colors which will be applied to the navigation markup in the front-end. param: array $attributes Navigation block attributes. return: array Colors CSS classes and inline styles. |
| block_core_navigation_build_css_font_sizes( $attributes ) X-Ref |
| Build an array with CSS classes and inline styles defining the font sizes which will be applied to the navigation markup in the front-end. param: array $attributes Navigation block attributes. return: array Font size CSS classes and inline styles. |
| block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) X-Ref |
| Filter out empty "null" blocks from the block list. 'parse_blocks' includes a null block with '\n\n' as the content when it encounters whitespace. This is not a bug but rather how the parser is designed. param: array $parsed_blocks the parsed blocks to be normalized. return: array the normalized parsed blocks. |
| block_core_navigation_block_tree_has_block_type( $blocks, $block_type, $skip_block_types = array() X-Ref |
| No description |
| block_core_navigation_block_contains_core_navigation( $inner_blocks ) X-Ref |
| Returns true if the navigation block contains a nested navigation block. param: WP_Block_List $inner_blocks Inner block instance to be normalized. return: bool true if the navigation block contains a nested navigation block. |
| block_core_navigation_get_fallback_blocks() X-Ref |
| Retrieves the appropriate fallback to be used on the front of the site when there is no menu assigned to the Nav block. This aims to mirror how the fallback mechanic for wp_nav_menu works. See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information. return: array the array of blocks to be used as a fallback. |
| block_core_navigation_get_post_ids( $inner_blocks ) X-Ref |
| Iterate through all inner blocks recursively and get navigation link block's post IDs. param: WP_Block_List $inner_blocks Block list class instance. return: array Array of post IDs. |
| block_core_navigation_from_block_get_post_ids( $block ) X-Ref |
| Get post IDs from a navigation link block instance. param: WP_Block $block Instance of a block. return: array Array of post IDs. |
| render_block_core_navigation( $attributes, $content, $block ) X-Ref |
| Renders the `core/navigation` block on server. param: array $attributes The block attributes. param: string $content The saved content. param: WP_Block $block The parsed block. return: string Returns the navigation block markup. |
| register_block_core_navigation() X-Ref |
| Register the navigation block. |
| block_core_navigation_add_support_classes_to_container( $block_content, $block ) X-Ref |
| Adds Navigation block support classes to inner list containers. State block support adds the generated `wp-states-*` class to the outer block wrapper. The Navigation block renders its menu items inside an inner `wp-block-navigation__container` list, so the same state class is also needed there for state styles to apply directly to the menu list. Navigation also uses layout classes on its outer wrapper to define custom properties consumed by its inner containers. Viewport layout styles cannot change those classes, so equivalent custom properties and a scoping class are generated for each configured viewport layout. Currently this is required as a workaround because of how difficult it is for nav child blocks to inherit styles through the complex responsive nav block html. The bug in https://github.com/WordPress/gutenberg/issues/62690 also prevents inheritance. param: string $block_content The block content. param: array $block The full block, including name and attributes. return: string The updated block content. |
| block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) X-Ref |
| No description |
| block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) X-Ref |
| Turns menu item data into a nested array of parsed blocks param: array $menu_items An array of menu items that represent param: array $menu_items_by_parent_id An array keyed by the id of the return: array An array of parsed block data. |
| block_core_navigation_get_classic_menu_fallback() X-Ref |
| Get the classic navigation menu to use as a fallback. return: object WP_Term The classic navigation. |
| block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) X-Ref |
| No description |
| block_core_navigation_maybe_use_classic_menu_fallback() X-Ref |
| If there's a classic menu then use it as a fallback. return: array the normalized parsed blocks. |
| block_core_navigation_get_most_recently_published_navigation() X-Ref |
| Finds the most recently published `wp_navigation` Post. return: WP_Post|null the first non-empty Navigation or null. |
| block_core_navigation_get_submenu_visibility( $attributes ) X-Ref |
| Returns the submenu visibility value with backward compatibility for the deprecated openSubmenusOnClick attribute. This function centralizes the migration logic from the boolean openSubmenusOnClick to the new submenuVisibility enum. Backward compatibility: WordPress applies default attribute values, so submenuVisibility will always have a value even for legacy blocks. We check the legacy openSubmenusOnClick attribute first to preserve original behavior for blocks saved before the migration. param: array $attributes Block attributes containing submenuVisibility and/or openSubmenusOnClick. return: string The visibility mode: 'hover', 'click', or 'always'. |
| block_core_navigation_get_layout_custom_property_declarations( $layout ) X-Ref |
| Returns the custom properties used by the Navigation block for a layout. param: array $layout Layout configuration. return: array Navigation layout custom property declarations. |
| Generated : Tue Oct 20 08:20:34 2026 | Cross-referenced by PHPXref |