← All changes
|
build/scripts/block-library/navigation-submenu.php
+17
-3
23.5.0
→
trunk
View file →
| @@ -75,12 +75,15 @@ | ||
| 75 | 75 | */ |
| 76 | 76 | function gutenberg_render_block_core_navigation_submenu( $attributes, $content, $block ) { |
| 77 | 77 | // Check if this navigation item should render based on post status. |
| 78 | 78 | if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { |
| 79 | - if ( ! gutenberg_block_core_shared_navigation_item_should_render( $attributes, $block ) ) { | |
| 80 | - return ''; | |
| 81 | - } | |
| 79 | + $should_render = gutenberg_block_core_shared_navigation_item_should_render( $attributes, $block ); | |
| 80 | + } else { | |
| 81 | + $should_render = block_core_shared_navigation_item_should_render( $attributes, $block ); | |
| 82 | 82 | } |
| 83 | + if ( ! $should_render ) { | |
| 84 | + return ''; | |
| 85 | + } | |
| 83 | 86 | |
| 84 | 87 | // Don't render the block's subtree if it has no label. |
| 85 | 88 | if ( empty( $attributes['label'] ) ) { |
| 86 | 89 | return ''; |
| @@ -267,8 +270,19 @@ | ||
| 267 | 270 | |
| 268 | 271 | $style_attribute = ''; |
| 269 | 272 | if ( array_key_exists( 'style', $colors_supports ) ) { |
| 270 | 273 | $style_attribute = $colors_supports['style']; |
| 274 | + } | |
| 275 | + | |
| 276 | + /* | |
| 277 | + * Shadow serialization is skipped for this block so the shadow lands on the | |
| 278 | + * dropdown panel, the floating layer it is meant for, and not the menu item. | |
| 279 | + */ | |
| 280 | + if ( ! empty( $attributes['style']['shadow'] ) ) { | |
| 281 | + $shadow_styles = gutenberg_style_engine_get_styles( array( 'shadow' => $attributes['style']['shadow'] ) ); | |
| 282 | + if ( ! empty( $shadow_styles['css'] ) ) { | |
| 283 | + $style_attribute .= $shadow_styles['css']; | |
| 284 | + } | |
| 271 | 285 | } |
| 272 | 286 | |
| 273 | 287 | if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) { |
| 274 | 288 | $tag_processor = new WP_HTML_Tag_Processor( $html ); |