-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Navigation: Use the shared icon rendering functions for all navigation blocks #76372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,7 +240,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { | |
| if ( $show_submenu_indicators && $has_submenu ) { | ||
| // The submenu icon is rendered in a button here | ||
| // so that there's a clickable element to open the submenu. | ||
| $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_render_submenu_icon() . '</button>'; | ||
| $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">'; | ||
| 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(); | ||
| } | ||
|
Comment on lines
+244
to
+248
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bummer that this is so repetitive, but it's cheap so I don't have a strong opinion against removing the repetition. |
||
| $html .= '</button>'; | ||
| } | ||
| } else { | ||
| $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">'; | ||
|
|
@@ -262,7 +268,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { | |
| $html .= '</button>'; | ||
|
|
||
| if ( $has_submenu ) { | ||
| $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_render_submenu_icon() . '</span>'; | ||
| $html .= '<span class="wp-block-navigation__submenu-icon">'; | ||
| 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(); | ||
| } | ||
| $html .= '</span>'; | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're not using
block_core_navigation_render_submenu_icon, should we remove therequire_onceof the files we don't use, just like we did in #76077?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was going to do that in a follow up (I have the PR ready here! #76373)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up sounds good 👍