Opened 4 weeks ago
Closed 5 days ago
#66114 closed enhancement (fixed)
Icons: Add a `core-admin` icon collection for the admin interface
| Reported by: | wildworks | Owned by: | wildworks |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | gutenberg-merge has-patch has-unit-tests |
| Cc: | Focuses: |
Description (last modified by )
Backports https://github.com/WordPress/gutenberg/pull/83261 to core.
The Icons API introduced in [62748] registers the default WordPress icons in the core collection.
#65089 proposes replacing the dashicons in the admin bar and the admin menu with SVG icons rendered through wp_get_icon(). Those icons live in the core collection, so a plugin that unregisters that collection — something it might legitimately do to hide the default WordPress icons from the Icon block — would also wipe out every icon in the dashboard chrome.
The proposal is to add a core-admin icon collection for the icons the admin interface renders. A new admin property in the icons manifest marks those icons: they are registered in core-admin in addition to core, always as non-public icons there, so the collection contributes nothing to the icons REST API or to the Icon block.
The core-admin collection is not protected in any way the other collections are not. Keeping the rules simple was preferred over guarding it.
Change History (7)
This ticket was mentioned in PR #13551 on WordPress/wordpress-develop by @wildworks.
4 weeks ago
#1
- Keywords has-patch has-unit-tests added
@wildworks commented on PR #13551:
3 weeks ago
#2
Closing this based on https://github.com/WordPress/gutenberg/pull/83012#issuecomment-5748999409
This ticket was mentioned in PR #13625 on WordPress/wordpress-develop by @wildworks.
3 weeks ago
#3
Backports https://github.com/WordPress/gutenberg/pull/83261 to core.
#65089 proposes replacing the dashicons in the admin bar and the admin menu with SVG icons rendered through wp_get_icon(). Those icons live in the core collection, so a plugin that unregisters that collection — something it might legitimately do to keep the default icon set out of the Icon block — would also wipe out every icon in the dashboard chrome.
This replaces #13551, which took the reserved _builtin collection approach. Following the discussion, a plain second collection was preferred over a protected one.
How?
- A new
adminproperty in the icons manifest marks the icons the admin interface renders. An icon carrying it is registered in a newcore-admincollection in addition tocore, and is always non-public there. This is the collection the admin bar and the admin menu are meant to use. core-adminis not protected in any way the other collections are not. Keeping the rules simple was preferred over guarding it.- Since every icon in
core-adminis non-public, the collection contributes nothing to the icons REST API or to the Icon block. The collection itself is still exposed by the icon collections endpoint.
The manifest is generated from gutenberg/packages/icons by grunt copy:icon-library-manifest, so the admin flags arrive with the next Gutenberg hash bump. Until then no icon in core carries the flag, and the core-admin collection is registered but empty.
Testing Instructions
Run the PHP unit tests and confirm they pass:
npm run test:php -- --group icons
To exercise the registration before the flags land, add 'admin' => true to an entry in src/wp-includes/assets/icon-library-manifest.php and confirm that:
wp_get_icon( 'core-admin/<icon>' )returns the SVG markup.wp_get_icon( 'core/<icon>' )still returns it as well.await wp.apiFetch( { path: '/wp/v2/icons/core-admin' } )is empty, while/wp/v2/icon-collectionslistscore-admin.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: code generation and testing, with my supervision.
#4
@
3 weeks ago
- Description modified (diff)
- Summary Icons: Add a reserved `_builtin` icon collection → Icons: Add a `core-admin` icon collection for the admin interface
@wildworks commented on PR #13625:
5 days ago
#6
@peterwilsoncc There seem to be no merge conflicts locally. I was able to merge trunk into this branch as is.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Backports https://github.com/WordPress/gutenberg/pull/83012 to core.
#65089 proposes replacing the dashicons in the admin bar and the admin menu with SVG icons rendered through
wp_get_icon(). Those icons live in thecorecollection, so a plugin that unregisters that collection — something it might legitimately do to hide the default WordPress icons from the Icon block — would also wipe out every icon in the dashboard chrome.This PR adds a reserved
_builtincollection, holding a private copy of the icons that WordPress itself renders. Neither the collection nor its icons can be unregistered, and both are hidden from the icons REST API so the collection is never offered in the icon library. Icons flagged_builtinin the icon library manifest are registered there in addition to theircorecounterparts.The
corecollection keeps its current behaviour, so a plugin can still hide or replace it in the editor without breaking the dashboard.The manifest itself is generated from
gutenberg/packages/iconsbygrunt copy:icon-library-manifest, so the_builtinflags arrive with the next Gutenberg hash bump. Until then no icon in core carries the flag, and this change is covered by unit tests only.Testing Instructions
Run the PHP unit tests and confirm they pass:
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: code generation and testing, with my supervision.