Changeset 59775 for trunk/src/wp-includes/blocks/navigation-submenu.php
- Timestamp:
- 02/07/2025 03:44:07 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/navigation-submenu.php
r58187 r59775 83 83 $style_attribute = $font_sizes['inline_styles']; 84 84 85 $css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) );86 85 $has_submenu = count( $block->inner_blocks ) > 0; 87 86 $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); … … 100 99 $show_submenu_indicators; 101 100 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 102 121 $wrapper_attributes = get_block_wrapper_attributes( 103 122 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 ), 107 124 'style' => $style_attribute, 108 125 ) … … 160 177 // End appending HTML attributes to anchor tag. 161 178 179 $html .= '<span class="wp-block-navigation-item__label">'; 162 180 $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 } 163 189 164 190 $html .= '</a>'; … … 180 206 181 207 $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 } 182 215 183 216 $html .= '</button>'; … … 223 256 if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) { 224 257 $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' ) ) ) { 226 259 $tag_processor->add_class( 'current-menu-ancestor' ); 227 260 }
Note: See TracChangeset
for help on using the changeset viewer.