Navigation: Use the shared icon rendering functions for all navigation blocks#76372
Navigation: Use the shared icon rendering functions for all navigation blocks#76372
Conversation
|
Flaky tests detected in 053b669. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22954358235
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Thanks. Done! I'm concerned that we're going to end up with a lot of code like this but I guess we can cross that bridge when we come to it. |
| if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { | ||
| $html .= gutenberg_block_core_shared_navigation_render_submenu_icon(); | ||
| } else { | ||
| $html .= block_core_shared_navigation_render_submenu_icon(); | ||
| } |
There was a problem hiding this comment.
Bummer that this is so repetitive, but it's cheap so I don't have a strong opinion against removing the repetition.
|
|
||
| if ( isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'] && $has_submenu ) { | ||
| // The submenu icon can be hidden by a CSS rule on the Navigation Block. | ||
| $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_render_submenu_icon() . '</span>'; |
There was a problem hiding this comment.
Now that we're not using block_core_navigation_render_submenu_icon, should we remove the require_once of the files we don't use, just like we did in #76077?
There was a problem hiding this comment.
Yes, I was going to do that in a follow up (I have the PR ready here! #76373)
What?
We have two different definitions for the navigation submenu icon rendering functions. We should combine them into one.
Why?
Less code to maintain
How?
Remove the extra definition, and update the calls to reference the new function
Testing Instructions
Check that navigation blocks with submenus still display the chevron icon - you can replace the icon with some text to verify its working.