Make WordPress Core


Ignore:
Timestamp:
02/07/2025 03:44:07 PM (21 months ago)
Author:
joemcgill
Message:

Editor: Update packages for 6.8 pre-Betas.

Syncs @wordpress/* packages to the 'latest' npm tag.

Props mamaduka, joemcgill, youknowriad, swissspidy, sergiomdgomes, gziolo.
See #62887.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/navigation-submenu.php

    r58187 r59775  
    8383        $style_attribute = $font_sizes['inline_styles'];
    8484
    85         $css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) );
    8685        $has_submenu = count( $block->inner_blocks ) > 0;
    8786        $kind        = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] );
    … …  
    10099                $show_submenu_indicators;
    101100
     101        $classes = array(
     102                'wp-block-navigation-item',
     103        );
     104        $classes = array_merge(
     105                $classes,
     106                $font_sizes['css_classes']
     107        );
     108        if ( $has_submenu ) {
     109                $classes[] = 'has-child';
     110        }
     111        if ( $open_on_click ) {
     112                $classes[] = 'open-on-click';
     113        }
     114        if ( $open_on_hover_and_click ) {
     115                $classes[] = 'open-on-hover-click';
     116        }
     117        if ( $is_active ) {
     118                $classes[] = 'current-menu-item';
     119        }
     120
    102121        $wrapper_attributes = get_block_wrapper_attributes(
    103122                array(
    104                         'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) .
    105                         ( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) .
    106                         ( $is_active ? ' current-menu-item' : '' ),
     123                        'class' => implode( ' ', $classes ),
    107124                        'style' => $style_attribute,
    108125                )
    … …  
    160177                // End appending HTML attributes to anchor tag.
    161178
     179                $html .= '<span class="wp-block-navigation-item__label">';
    162180                $html .= $label;
     181                $html .= '</span>';
     182
     183                // Add description if available.
     184                if ( ! empty( $attributes['description'] ) ) {
     185                        $html .= '<span class="wp-block-navigation-item__description">';
     186                        $html .= wp_kses_post( $attributes['description'] );
     187                        $html .= '</span>';
     188                }
    163189
    164190                $html .= '</a>';
    … …  
    180206
    181207                $html .= '</span>';
     208
     209                // Add description if available.
     210                if ( ! empty( $attributes['description'] ) ) {
     211                        $html .= '<span class="wp-block-navigation-item__description">';
     212                        $html .= wp_kses_post( $attributes['description'] );
     213                        $html .= '</span>';
     214                }
    182215
    183216                $html .= '</button>';
    … …  
    223256                if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) {
    224257                        $tag_processor = new WP_HTML_Tag_Processor( $html );
    225                         while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) {
     258                        while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item' ) ) ) {
    226259                                $tag_processor->add_class( 'current-menu-ancestor' );
    227260                        }
Note: See TracChangeset for help on using the changeset viewer.