| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Server-side rendering of the `core/navigation` block.
| File Size: | 1821 lines (64 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
WP_Navigation_Block_Renderer:: (48 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_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. return: bool Returns whether or not this is responsive navigation. param: array $attributes The block attributes. |
| has_submenus( $inner_blocks ) X-Ref |
| Returns whether or not a navigation has a submenu. return: bool Returns whether or not a navigation has a submenu and also sets the member variable. param: WP_Block_List $inner_blocks The list of inner blocks. |
| is_interactive( $attributes, $inner_blocks ) X-Ref |
| Determine whether the navigation blocks is interactive. return: bool Returns whether or not to load the view script. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. |
| does_block_need_a_list_item_wrapper( $block ) X-Ref |
| Returns whether or not a block needs a list item wrapper. return: bool Returns whether or not a block needs a list item wrapper. param: WP_Block $block The block. |
| get_markup_for_inner_block( $inner_block ) X-Ref |
| Returns the markup for a single inner block. return: string Returns the markup for a single inner block. param: WP_Block $inner_block The inner block. |
| get_template_part_blocks_html( $blocks ) X-Ref |
| Returns the html for blocks from a template part (without navigation container wrapper). return: string Returns the html for the template part blocks. param: WP_Block_List $blocks The list of blocks to render. |
| get_inner_blocks_html( $attributes, $inner_blocks ) X-Ref |
| Returns the html for the inner blocks of the navigation block. return: string 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. |
| get_inner_blocks_from_navigation_post( $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from the navigation post. return: WP_Block_List Returns the inner blocks for the navigation block. param: array $attributes The block attributes. |
| get_inner_blocks_from_fallback( $attributes ) X-Ref |
| Gets the inner blocks for the navigation block from the fallback. return: WP_Block_List Returns the inner blocks for the navigation block. param: array $attributes The block attributes. |
| disable_overlay_menu_for_nested_navigation_blocks( $blocks ) X-Ref |
| Recursively disables overlay menu for navigation blocks within overlay blocks. Prevents nested overlays (inception). return: array Modified blocks with overlayMenu set to 'never' for navigation blocks. param: array $blocks Array of parsed block arrays. |
| 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. return: WP_Block_List Returns the inner blocks for the overlay template part. param: string $overlay_template_part_id The overlay template part ID in format "theme//slug". param: array $attributes The block attributes. |
| get_inner_blocks( $attributes, $block ) X-Ref |
| Gets the inner blocks for the navigation block. return: WP_Block_List Returns the inner blocks for the navigation block. param: array $attributes The block attributes. param: WP_Block $block The parsed block. |
| get_navigation_name( $attributes ) X-Ref |
| Gets the name of the current navigation, if it has one. return: string Returns the name of the navigation. param: array $attributes The block attributes. |
| get_layout_class( $attributes ) X-Ref |
| Returns the layout class for the navigation block. return: string Returns the layout class for the navigation block. param: array $attributes The block attributes. |
| get_classes( $attributes ) X-Ref |
| Return classes for the navigation block. return: string Returns the classes for the navigation block. param: array $attributes The block attributes. |
| get_styles( $attributes ) X-Ref |
| Get styles for the navigation block. return: string Returns the styles for the navigation block. param: array $attributes The block attributes. |
| get_responsive_container_classes( $is_hidden_by_default, $has_custom_overlay, $colors ) X-Ref |
| Get responsive container classes for the navigation block. return: array Returns the responsive container classes. 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. |
| get_overlay_inline_styles( $has_custom_overlay, $colors ) X-Ref |
| Get overlay inline styles for the navigation block. return: string Returns the overlay inline styles. param: array $colors The colors array. |
| get_responsive_container_markup( $attributes, $inner_blocks, $inner_blocks_html ) X-Ref |
| Get the responsive container markup return: string Returns the 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. |
| get_nav_attributes( $attributes, $inner_blocks ) X-Ref |
| Get the wrapper attributes return: string Returns the navigation block markup. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks A list of inner blocks. |
| get_nav_element_directives( $is_interactive ) X-Ref |
| Gets the nav element directives. return: string the directives for the navigation element. param: bool $is_interactive Whether the block is interactive. |
| 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. return: string Returns the navigation wrapper markup. param: array $attributes The block attributes. param: WP_Block_List $inner_blocks The list of inner blocks. |
| get_unique_navigation_name( $attributes ) X-Ref |
| Returns a unique name for the navigation. return: string Returns a unique name for the navigation. param: array $attributes The block attributes. |
| render( $attributes, $content, $block ) X-Ref |
| Renders the navigation block. return: string Returns the navigation block markup. param: array $attributes The block attributes. param: string $content The saved content. param: WP_Block $block The parsed block. |
| block_core_navigation_get_menu_items_at_location( $location ) X-Ref |
| Returns the menu items for a WordPress menu location. return: array Menu items for the location. param: string $location The menu 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. return: array An array keyed by the id of the parent menu where each element param: array $menu_items Menu items to sort. |
| 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. return: WP_Block_List Returns the inner blocks for the navigation block. param: array $attributes The block attributes. |
| 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). return: bool True if a close button element is found. param: string $html The rendered overlay HTML. |
| 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. return: string Overlay close markup with the directives injected. param: WP_HTML_Tag_Processor $tags Markup of the navigation block. |
| 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. return: string Modified HTML with fetchpriority="low" on all IMG tags. param: string $overlay_blocks_html The rendered HTML of the overlay blocks. |
| 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. return: string Submenu markup with the directives injected. param: WP_HTML_Tag_Processor $tags Markup of the navigation block. param: array $block_attributes Block attributes. |
| 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. return: array Colors CSS classes and inline styles. param: array $attributes Navigation block attributes. |
| 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. return: array Font size CSS classes and inline styles. param: array $attributes Navigation block attributes. |
| 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. return: array the normalized parsed blocks. param: array $parsed_blocks the parsed blocks to be normalized. |
| 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. return: bool true if the navigation block contains a nested navigation block. param: WP_Block_List $inner_blocks Inner block instance to be normalized. |
| 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. return: array Array of post IDs. param: WP_Block_List $inner_blocks Block list class instance. |
| block_core_navigation_from_block_get_post_ids( $block ) X-Ref |
| Get post IDs from a navigation link block instance. return: array Array of post IDs. param: WP_Block $block Instance of a block. |
| render_block_core_navigation( $attributes, $content, $block ) X-Ref |
| Renders the `core/navigation` block on server. return: string Returns the navigation block markup. param: array $attributes The block attributes. param: string $content The saved content. param: WP_Block $block The parsed block. |
| register_block_core_navigation() X-Ref |
| Register the navigation block. |
| block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) X-Ref |
| Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly. return: array The block being rendered without typographic presets. param: array $parsed_block The block being rendered. |
| 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 return: array An array of parsed block data. 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 |
| 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. return: string The visibility mode: 'hover', 'click', or 'always'. param: array $attributes Block attributes containing submenuVisibility and/or openSubmenusOnClick. |
| Generated : Fri Jul 3 08:20:12 2026 | Cross-referenced by PHPXref |