From 0e41b5d52fdc6af6442816b5f465c9db9f84e126 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:51:18 +0200 Subject: Adding upstream version 6.6.1+dfsg1. Signed-off-by: Daniel Baumann --- wp-includes/blocks/navigation-submenu.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'wp-includes/blocks/navigation-submenu.php') diff --git a/wp-includes/blocks/navigation-submenu.php b/wp-includes/blocks/navigation-submenu.php index 2ae23a9..92b55e2 100644 --- a/wp-includes/blocks/navigation-submenu.php +++ b/wp-includes/blocks/navigation-submenu.php @@ -9,6 +9,8 @@ * 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. * + * @since 5.9.0 + * * @param array $context Navigation block context. * @return array Font size CSS classes and inline styles. */ @@ -43,6 +45,8 @@ function block_core_navigation_submenu_build_css_font_sizes( $context ) { /** * Returns the top-level submenu SVG chevron icon. * + * @since 5.9.0 + * * @return string */ function block_core_navigation_submenu_render_submenu_icon() { @@ -52,6 +56,8 @@ function block_core_navigation_submenu_render_submenu_icon() { /** * Renders the `core/navigation-submenu` block. * + * @since 5.9.0 + * * @param array $attributes The block attributes. * @param string $content The saved content. * @param WP_Block $block The parsed block. @@ -81,6 +87,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); $is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); + if ( is_post_type_archive() ) { + $queried_archive_link = get_post_type_archive_link( get_queried_object()->name ); + if ( $attributes['url'] === $queried_archive_link ) { + $is_active = true; + } + } + $show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon']; $open_on_click = isset( $block->context['openSubmenusOnClick'] ) && $block->context['openSubmenusOnClick']; $open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] && @@ -238,6 +251,8 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { /** * Register the navigation submenu block. * + * @since 5.9.0 + * * @uses render_block_core_navigation_submenu() * @throws WP_Error An WP_Error exception parsing the block definition. */ -- cgit v1.2.3