#64651 closed task (blessed) (fixed)
Icons: Backport Icons Registry and wp/v2/icons endpoint from Gutenberg
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Focuses: | Cc: |
Description
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/72215
Blocker for the Icon block: https://github.com/WordPress/gutenberg/pull/71227
Blessed in: https://github.com/WordPress/gutenberg/issues/16484
The work in Gutenberg introduced a new singleton registry class, WP_Icons_Registry, to mediate access to SVG icons. For 7.0, this registry should be closed to third parties and only serve a subset of the icons defined in @wordpress/icons. Starting with 7.1, or as soon as possible, the registry should be open to third parties to register custom icons.
As a companion to the registry class, a new REST API controller defined endpoints /wp/v2/icons and /wp/v2/icons/<slug>, meant only for retrieval.
Together, they are essential infrastructure to the Icon block, which is to be shipped in 7.0 too. After 7.0, that block should be able to allow users to add custom icons to their collection.
Change History (19)
This ticket was mentioned in PR #10909 on WordPress/wordpress-develop by @mcsf.
4 weeks ago
#1
- Keywords has-patch has-unit-tests added
@wildworks commented on PR #10909:
3 weeks ago
#4
- Copy all icons, but check whether the
publicfield istruein the icon registry.- When copying icons, if the
publicfield is nottrue, do not copy the icon. Additionally, remove icons not marked as'public' => truefrom themanifest.phpfile.Perhaps the latter approach is ideal if we don't want to ship internal icons entirely into core, but it may be a bit more complicated. What do you think?
@mcsf Since we're getting close to the Beta 1 release and the former approach is simpler, I’ve committed 970944b using that approach. I’d appreciate your thoughts.
@mcsf commented on PR #10909:
3 weeks ago
#5
@mcsf Since we're getting close to the Beta 1 release and the former approach is simpler, I’ve committed 970944b using that approach. I’d appreciate your thoughts.
Sorry, I thought I had submitted a reply but apparently not. Yes, that's what I would prefer!
@wildworks commented on PR #10909:
3 weeks ago
#6
Update:
- 7b941e456b0c4e7e9603c13c6b8ee27f75cc8d82: I skipped the failing tests because there are no public icons in
manifest.phpyet. Once the Gutenberg commit hash is updated, we'll be able to re-enable the skipped tests. At first, I thought about registering a mock icon, but after reading this comment, I realized that that approach wasn't the right one. - 15a38c31b97e5988027998e2319e05e48d1434f9: I added a
tickettag.
@mcsf commented on PR #10909:
3 weeks ago
#7
- 7b941e4: I skipped the failing tests because there are no public icons in
manifest.phpyet. Once the Gutenberg commit hash is updated, we'll be able to re-enable the skipped tests. At first, I thought about registering a mock icon, but after reading this comment, I realized that that approach wasn't the right one.
Awesome, thanks. For the record, I just tested building WordPress with an updated Gutenberg ref, removed the tests' skip instructions, and I can confirm that the tests pass with the right manifest. 👍
@mcsf commented on PR #10909:
3 weeks ago
#8
I think we should be good to go. What else is missing for this initial commit?
@mcsf commented on PR #10909:
3 weeks ago
#9
It looks almost good, but I overlooked an important point: the text domain of the icon in the
manifest.phpfile isgutenberg, so it will not be translatable in core. Would it be difficult to remove this text domain during the build process?
Great point. Will explore this after a call I'm on!
@wildworks commented on PR #10909:
3 weeks ago
#10
@mcsf, I think I've probably addressed all of that, but feel free to update!
@mcsf commented on PR #10909:
3 weeks ago
#11
@mcsf, I think I've probably addressed all of that, but feel free to update!
Oh, I didn't realise! I only realised you had already done this when I tried to push and had merge conflicts. 😅 In any case, thanks! Looks exactly like what I had.
#12
@
3 weeks ago
- Owner set to mcsf
- Resolution set to fixed
- Status changed from new to closed
In 61674:
@mcsf commented on PR #10909:
3 weeks ago
#13
Sorry for the confusion! But I think this PR is ready 👍
P.S. I'm planning to make some adjustments to how
manifest.phpworks to avoid shipping unnecessary icon sets in core. I'll be submitting a PR in Gutenberg soon.
I wanted to get this big patch committed once and for all, but I have since reviewed your manifest.php PR, so this is a heads-up that I'll commit a follow-up to remove the ! ( $icon_data['public'] ?? false ) guard.
@wildworks commented on PR #10909:
3 weeks ago
#14
this is a heads-up that I'll commit a follow-up to remove the "! ( $icon_datapublic? ?? false )" guard.
Thank you! I was going to let you know that too 😄
This ticket was mentioned in PR #11047 on WordPress/wordpress-develop by @mcsf.
2 weeks ago
#17
Trac ticket: https://core.trac.wordpress.org/ticket/64651
Context: https://github.com/WordPress/gutenberg/pull/75878
- I'm fairly confident about the switch to
protectedvisibility. It would be nice to include in 7.0 Beta. - I'm less so about introducing a filter. We don't have to rush that.
- Unsolved: can we do anything Core-side to make it easier to _replace WP_Icon_Registry entirely_? (See comment.)
Trac ticket:
## Use of AI Tools
None
@wildworks commented on PR #11047:
2 weeks ago
#19
This PR was committed in changeset 61748.
Companion PR to Gutenberg's https://github.com/WordPress/gutenberg/pull/72215 and https://github.com/WordPress/gutenberg/pull/74943
Builds on #10795