Add a few filters to make it possible to change the default navigation icons#44228
Add a few filters to make it possible to change the default navigation icons#44228SGr33n wants to merge 2 commits intoWordPress:trunkfrom
Conversation
Added a few filters to make it possible to programmatically change the navigation icons.
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @SGr33n! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Fix lint check errors.
|
|
||
| $should_display_icon_label = isset( $attributes['hasIcon'] ) && true === $attributes['hasIcon']; | ||
| $toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg>'; | ||
| $toggle_button_icon = apply_filters( |
There was a problem hiding this comment.
Thanks for picking this up.
The problem with filtering here is that the user could have selected a particular icon in the editor, but then a filter applied by a plugin renders something completely different on the frontend, which results in a very confusing experience.
I think ideally the solution would be a filter that modifies the array of available icons for the user to select.
That may require JS and PHP code though.
There was a problem hiding this comment.
You're right, or replace filters with making possible to upload custom icons on Gutenberg.
|
Warning: Type of PR label error To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. |
|
If you're still interested in this; there's active discussion about this at #53510 |
Added a few filters to make it possible to programmatically change the navigation icons.
At time #43674 there is no chance to change the default navigation icons. The only way to customize them is filtering inside render_block_core/navigation and making a string replacement on $block_content... not really the cleanest way.
So I added a few filters to make it possible.
They are: