wp-includes/blocks/navigation.php:730Get the responsive container markup
$attributesarray$inner_blocksWP_Block_List$inner_blocks_htmlstringstring<?php private static function get_responsive_container_markup( $attributes, $inner_blocks, $inner_blocks_html ) { $is_interactive = static::is_interactive( $attributes, $inner_blocks ); $colors = block_core_navigation_build_css_colors( $attributes ); $modal_unique_id = wp_unique_id( 'modal-' ); $is_hidden_by_default = isset( $attributes['overlayMenu'] ) && 'always' === $attributes['overlayMenu']; // Set-up variables for custom overlays. $has_custom_overlay = false; $close_button_markup = ''; $has_custom_overlay_close_block = false; $overlay_blocks_html = ''; $custom_overlay_markup = ''; // Check if an overlay template part is selected and render it. // This needs to happen before building classes so we know if overlay blocks actually exist. if ( ! empty( $attributes['overlay'] ) ) { // Get blocks from the overlay template part. $overlay_blocks = static::get_overlay_blocks_from_template_part( $attributes['overlay'], $attributes ); // Render template part blocks directly without navigation container wrapper. $overlay_blocks_html = static::get_template_part_blocks_html( $overlay_blocks ); // Check if overlay contains a navigation-overlay-close block (detect in rendered HTML so it works with patterns). $has_custom_overlay_close_block = block_core_navigation_overlay_html_has_close_block( $overlay_blocks_html ); // Add Interactivity API directives to the overlay close block if present. if ( $has_custom_overlay_close_block && $is_interactive ) { $tags = new WP_HTML_Tag_Processor( $overlay_blocks_html ); $overlay_blocks_html = block_core_navigation_add_directives_to_overlay_close( $tags ); } // Images in the overlay are hidden until the menu is opened. Pre-set // fetchpriority="low" so that when wp_filter_content_tags() processes the // parent template part, it sees the attribute already present and calls // wp_get_loading_optimization_attributes() with fetchpriority="low", which both prevents // fetchpriority="high" from being added and stops the LCP counter from being incremented. $overlay_blocks_html = block_core_navigation_set_overlay_image_fetch_priority( $overlay_blocks_html ); } $has_custom_overlay = ! empty( $overlay_blocks_html ); $responsive_container_classes = static::get_responsive_container_classes( $is_hidden_by_default, $has_custom_overlay, $colors ); $open_button_classes = array( 'wp-block-navigation__responsive-container-open', $is_hidden_by_default ? 'always-shown' : '', ); $should_display_icon_label = isset( $attributes['hasIcon'] ) && true === $attributes['hasIcon']; $toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7.5h16v1.5H4z"></path><path d="M4 15h16v1.5H4z"></path></svg>'; if ( isset( $attributes['icon'] ) ) { if ( 'menu' === $attributes['icon'] ) { $toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 5v1.5h14V5H5z"></path><path d="M5 12.8h14v-1.5H5v1.5z"></path><path d="M5 19h14v-1.5H5V19z"></path></svg>'; } } $toggle_button_content = $should_display_icon_label ? $toggle_button_icon : __( 'Menu' ); $toggle_close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg>'; $toggle_close_button_content = $should_display_icon_label ? $toggle_close_button_icon : __( 'Close' ); $toggle_aria_label_open = $should_display_icon_label ? 'aria-label="' . __( 'Open menu' ) . '"' : ''; // Open button label. $toggle_aria_label_close = $should_display_icon_label ? 'aria-label="' . __( 'Close menu' ) . '"' : ''; // Close button label. // Add Interactivity API directives to the markup if needed. $open_button_directives = ''; $responsive_container_directives = ''; $responsive_dialog_directives = ''; $close_button_directives = ''; if ( $is_interactive ) { $open_button_directives = ' data-wp-on--click="actions.openMenuOnClick" data-wp-on--keydown="actions.handleMenuKeydown" '; $responsive_container_directives = ' data-wp-class--has-modal-open="state.isMenuOpen" data-wp-class--is-menu-open="state.isMenuOpen" data-wp-watch="callbacks.initMenu" data-wp-on--keydown="actions.handleMenuKeydown" data-wp-on--focusout="actions.handleMenuFocusout" tabindex="-1" '; $responsive_dialog_directives = ' data-wp-bind--aria-modal="state.ariaModal" data-wp-bind--aria-label="state.ariaLabel" data-wp-bind--role="state.roleAttribute"Introduced in 6.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/blocks/navigation.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.